s5kyjq
Last Updated: February 25, 2016
·
1.885K
· rooftopsparrow

Script tag highlighting for TextMate and Sublime Text

TextMate by default will highlight anything in a script tag as javascript.
But for Backbone.js and other javascript MVC frameworks, the script tag is used as a template container. So this will remove javascript highlighting and use html highlighting instead for any

<script type="text/template">

Replace this line in the Bundle Editor for HTML language:

begin = '(?:^\s+)?(<)((?i:script))\b(?![^>]*/>)';

with this line:

begin = '(?:^\s+)?(<)((?i:script))\b(?!([^>]*text/template[^>]*|[^>]*/>))';

This also works for SublimeText 2.

gist
source

2 Responses
Add your response

6135

hey where do u do this for sublime?

over 1 year ago ·
6136

dont worry found it in xml HTML.tmLanguage, works perfectly just need to encode < with < etc :) THANKS

over 1 year ago ·