Using templates to render HTML in Javascript is great; but unfortunately Sublime Text 2 treats templates embedded in script tags as Javascript (which means syntax highlighting and completions don't work correctly). Luckily, this can easily be fixed by tweaking Sublime's HTML language file.
Here's what you need to do:
-
Go to Sublime's
Packagesdirectory (or the use thePreferences -> Browse Packages…menu item). -
Open the
HTML/HTML.tmLanguagefile. -
Change line 286 from:
<string>(?:^\s+)?(<)((?i:script))\b(?![^>]*/>)</string>to:
<string>(?:^\s+)?(<)((?i:script))\b(?![^>]*/>)(?!.*type=["']text/template['"])</string>
Now any script tags with a type of text/template will be treated as HTML:
<script type="text/template">{{title}}</script>
GitHub Comments