Reputation: 1676
I have recently been incorporating Handlebars.js into some new projects. I have been using inline Handlebars templates, as well as regular inline javascript.
The problem is that Sublime Text 2 treats inline Handlebars templates as if they were JS, which means the syntax coloring is completely wrong.
One proposed solution I've come across is to simply comment out the inline Javascript portion of Sublime Text's HTML.tmLanguage file, from lines 284 to 379.
While this does result in proper coloring of Handlebars templates, it also hoses the syntax coloring for inline Javascript.
Is there a way to get the best of both worlds here? Maybe a way to edit the following line from HTML.tmLanguage to make it NOT apply to any script tag with type="text/x-handlebars-template"
?
<string>(?:^\s+)?(<)((?i:script))\b(?![^>]*/>)</string>
Upvotes: 3
Views: 690
Reputation: 1676
User Iamntz was able to answer my question on the sublimetext forum.
The winning regex is:
<string>(?:^\s+)?(<)((?i:script))\b(?!([^>]*text/x-handlebars-template[^>]*|[^>]*/>))</string>
Upvotes: 4