So, i'm using underscore.js templates, in which i have to put my html template inside a script tag, like this
<script id="contactTemplate" type="text/template"> <img src="{{ photo }}" alt="{{ name }}" /> <h1>{{ name }}<span>{{ type }}</span></h1> <div>{{ address }}</div> <dl> <dt>Tel:</dt><dd>{{ tel }}</dd> <dt>Email:</dt><dd><a href="mailto:{{ email }}">{{ email }}</a></dd> </dl> </script>
but sublime text 2 is evaluating the code inside as regular js, how can i change that?
Thanks in advance!
"Browse Packages"
in the menu (where the menu item is depends on your platform).HTML/HTML.tmLanguage
Change this line (line 286 in my HTML.tmLanguage
):
<string>(?:^\s+)?(<)((?i:script))\b(?![^>]*/>)</string>
to this:
<string>(?:^\s+)?(<)((?i:script))\b(?![^>]*/>)(?!.*type=["']text/template['"])</string>
Now any script tags with type="text/template"
or type='text/template'
will render as html and not javascript.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With