Skip to content

Instantly share code, notes, and snippets.

@rooftopsparrow
Created June 19, 2012 20:42
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rooftopsparrow/2956428 to your computer and use it in GitHub Desktop.
Save rooftopsparrow/2956428 to your computer and use it in GitHub Desktop.
Telling TextMate to ignore <script type="text/template"> tags as javascript and instead highlight as html.

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"> tag.

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[^>]*|[^>]*/>))';

source

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment