Sublime Forum

How can I get my .scss files to open with the SCSS syntax?

#1

Hi folks,

I’ve been battling with this for a little while but it just got to the point now where my annoyance of it is driving me to seek help from you fine people.

Essentially, I use SCSS for most of my CSS authoring, I rarely ever use the older/original SASS syntax itself, so I want to be able to quick find (CMD+T) my application.css.scss file and have it open with the SCSS syntax.

The problem with this is that:

When SASS bundle is installed, the file will open with SASS syntax instead of SCSS.
I’ve tried the View > Syntax > Open all with current extension as… > SCSS option however after restarting Sublime the settings are reverted and SASS is the default again.

This has prompted me to just uninstall/remove the SASS bundle (via Package Control) all-together however this leads to another issue…
When the SASS bundle is uninstalled, I get an error while using quick find and I come across the scss file.

The only way to remove this error seems to be installing the SASS bundle again but then I’m back to it being the default syntax… vicious circle.

Any ideas would be much appreciated.

Thanks for reading,
J.

PS: Here is a screenshot of the error message:

0 Likes

Sass/syntaxes/sass.tmlanguage error - ST3
#2

I have the same issue and am wondering if someone has a fix for this.
After the .scss file is loaded selecting SCSS highlights as normal.

Please help

0 Likes

#3

I have the SCSS package [1] installed (through Package Control) and don’t have any problems with .scss files. If that doesn’t work for you, you can give DetectSyntax [2] a shot (but you really shouldn’t need to resort to that).

[1] github.com/kuroir/SCSS.tmbundle … blimeText2
[2] github.com/phillipkoebbe/DetectSyntax

0 Likes

#4

It’s a bug. The Package Manager installs the Sass/SCSS stuff in wrong-case folder names and seems like ST is hard-coded or something as in what folder to look in…

I had to rename my Scss folder to SCSS and restart ST2.
That’s it.

Should look like this:

~/.config/sublime-text-2/Packages$ ls S Sass/ Scala/ SCSS/ ShellScript/ SQL/
Oh and there’s also this file “Packages/SASS/Syntaxes/SASS.tmLanguage” that you might need to rename from Sass.tmLanguage to SASS.tmLanguage. I had.

0 Likes

#5

Hi jannisg, I hope not too late, if so will then as antecedent.

First of all, I had the same problem once uninstall the SASS and subsequently to install the SCSS package. I could solve it in the following way:

Inside the folder /home/user/.config/sublime-text-2/Packages/User (I use Linux, so I do not know the folder’s name on MacOS), we must edit 2 files:

Note: Be sure to close all windows of ST2 before proceeding.

1.- Package Control.sublime-settings

You must delete the line: SASS, and save it.

2.- syntax_highlighting.py

You must edit the next line to: elif name-5:] == “.scss”:, thus leaving: set_syntax(view, “SCSS”, “SCSS”) and save it.

Now we go up one level in the directory tree (/home/user/.config/sublime-text-2) and inside the Settings folder, we must edit the file:

3.- Session.sublime_session

Note: I had to edit that file from the command line because with other text editors could not do it (I use nano). I do not know the reason for this.

And we replace all lines containing the string: “…SASS.tmLanguage” by “Packages/SCSS/SCSS.tmLanguage” and save it.

That would be all :smiley:.

Hope I have helped in solving the problem :wink:

0 Likes

#6

Thanks perseo!

That did the trick, no more errors and proper highlighting on the .scss files, thank you.

0 Likes

#7

You may have gotten this set up already, but I was having this issue with SASS. I think an easier way is:

When you have a SASS/SCSS file open, go to View --> Syntax --> Open all with current extension as… and select SASS.

0 Likes