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.
Written by Jonathan Nicholson
Related protips
2 Responses
hey where do u do this for sublime?
over 1 year ago
·
dont worry found it in xml HTML.tmLanguage, works perfectly just need to encode < with < etc :) THANKS
over 1 year ago
·
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Textmate
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#