Will Hitchcock
Will Hitchcock

Reputation: 4868

Sublime Text open *.handlebars.coffee as HTML file

I'm trying to configure Sublime Text 2 to open up *.handlebars.coffee files using HTML syntax highlighting as a default. I know that I can change the default syntax highlighting for all .coffee files, but is there a way to change the defaults for a file with two extensions?

I've seen this similar post but this does not quite answer my question: Set default syntax to different filetype in Sublime Text 2

Upvotes: 4

Views: 1489

Answers (1)

dbn
dbn

Reputation: 13930

You can add handlebars.coffee to the fileTypes array in HTML.tmLanguage. After I did that, Sublime opened an example handlebars.coffee file as html syntax. Here's the relevant lines from my HTML.tmLanguage file:

<key>fileTypes</key>
<array>
    <string>handlebars.coffee</string>
    <string>html</string>
    <string>htm</string>
    etc.
</array>

You can access this file by opening the HTML folder under preferences > browse packages...

Make sure to save a new version of this file in your User preference folder. This will retain it through updates.

Upvotes: 7

Related Questions