Created
October 19, 2015 21:06
-
-
Save dana-ross/5330bbc7ca22a2141bc0 to your computer and use it in GitHub Desktop.
Use underscore.js template engine with Mustache-style template tags (including escaping) instead of concatenation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
_.template( | |
'[{{{ shortcodeString }}} url="{{{ url }}}" width="{{{ width }}}" height="{{{ height }}}"]', | |
{'shortcodeString': 'test', | |
'url': 'http://example.com', | |
'width': '100', | |
'height': '200' | |
}, { | |
interpolate: /\{\{([\s\S]+?)\}\}/g, | |
escape: /\{\{\{([\s\S]+?)\}\}\}/g} | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment