I recently upgraded to the newest build of sublime text (Version 3.1.1 Build 3176) and have lost syntax highlighting for html contained inside tags.
For context, I'm using scripts of type x-template to create Vue.js components inside a file saved with a .html extension.
My file looks something like this:
<!-- comp.html -->
<script type="text/x-template" id="comp-template">
<div id="comp-template>
<h2> {{ componentTitle }} </h2>
</div>
</script>
Previous versions of Sublime Text highlighted the html within those script tags by default, but now it no longer seems to be working. What is the best way to get sublime to once again recognize the HTML within the x-template script tags?
EDIT: there is now a package for that, called "Vue Syntax Highlight"
Here is a way to do it:
name: HTML
to name: HTML-Vue
- match: '(<)((?i:script))\b'
to - match: '(<)((?i:script))\b(?![^>]*/>)(?![^>]*(?i:type.?=.?text/((?!javascript).*)))'
HTML-Vue.sublime-syntax
%AppData%\Sublime Text 3\Packages\User\HTML-Vue.sublime-syntax
)View > Syntax > Open all with current extension as… > HTML-Vue
I have the same issue as you. As a temporary workaround to enable syntax highlight for <script type="text/x-template">...</script>
:
C:\Program Files\Sublime Text 3\Packages\HTML.sublime-package
FYI I reported your issue into Sublime Forum.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With