So, i\'m using underscore.js templates, in which i have to put my html template inside a script tag, like this
For those of us using Sublime Text 3
I thought I'd consolidate the information into something easier to find, since none of the answers or comments directly gave me the solution I needed. Matt York's answer is mostly correct, but Shane N's solution is a bit more flexible:
<string>(?:^\s+)?(<)((?i:script))\b(?![^>]*/>)(?!.*type=["']text/(template|html)['"])</string>
You can find HTML.sublime-package inside C:\Program Files\Sublime Text 3\Packages, as mentioned by PAEz.
Instructions
<key>begin</key>.zip to .sublime-package (make sure Sublime isn't running while you do this)For those of us using Sublime Text 3 use the plugin "PackageResourceViewer" to edit HTML.sublime-package
PackageResourceViewer
"Browse Packages" in the menu (where the menu item is depends on your platform).HTML/HTML.tmLanguageChange 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.
Because modifying built-in packages isn't exactly easy, safe, or portable (especially in ST3), I split out Matt York's change into its own package.
It is available via Package Control, and supports both Sublime Text 2 and 3 on all platforms.
HTML Underscore Syntax