I am working with some .scss.liquid
files and they always open as HTML Liquid, no matter how many times I set the syntax.
Update:
I tried open all with current extension as option, but unfortunately this affects files that are .js.liquid
and .html.liquid
as well.
Sublime Text allows you to apply settings on a per-language basis (actually, per syntax). One of the available settings allows you to map file extensions to the given syntax.
Assuming you're using a syntax named SCSS
, Create an SCSS settings file in your User settings: /path/to/packages/User/SCSS.sublime-settings
, then add the file extension setting:
{
"extensions":
[
"scss.liquid"
]
}
As you can see, it's a json file, and extensions
is a list, so you can add as many file extensions as you need. Do not add the leading dot.
Caveat about the file name
The file name for the settings file must match the actual syntax name, including case. In this case it has to be SCSS.sublime-settings
. Other examples include:
NAnt Build File.sublime-settings
Ruby on Rails.sublime-settings
Rd (R Documentation).sublime-settings
Java Server Page (JSP).sublime-settings
I found a relatively straightforward solution to this problem.
- Install ApplySyntax
Create the following rules in ApplySyntax.sublime-settings -- User
:
"syntaxes": [
{
"syntax": "SCSS",
"extensions": ["scss.liquid"]
},
{
"syntax": "JavaScript/JavaScript",
"extensions": ["js.liquid"]
},
]
Update: I now see there is no need for an extra package. Please see accepted answer and my video (in the comments) for tips on how to make it work.