Webstorm 6 - How to make scsc files ignore

I would like the file watcher for SCSS files to ignore files with file names starting with underscores, for example _buttons.scss.

How can I do it?

+2
source share
2 answers

Start by adding _ to the file you want to ignore ... Done! From the doc:

Partials

If you have a SCSS or Sass file that you want to import but don’t want to compile into a CSS file, you can add an underscore to the beginning of the file name. This will tell Sas not to compile it into a regular CSS file. You can then import these files without using underscores.

For example, you might have _colors.scss. Then the _colors.css file will be created, and you can do

@import "colors";

So adding underscores will do the job. Just do not import.

Be careful when naming your files, because if you have style.scss and _style.scss , Sass will see them as the same file name and cause an error:

 >>> Change detected to: /Users/allcaps/test/style.scss WARNING: In /Users/allcaps/test: There are multiple files that match the name "style.scss": _style.scss style.scss 

A simple workaround is to add two underscores: __style.scss .

+4
source

@LazyOne has the right idea. You can create a Scope that excludes underscored (_) files. The page http://www.jetbrains.com/phpstorm/webhelp/scopes.html#d437174e402 contains more information about this, but basically you select the desired folder after creating the custom area, and then add it again to the area field with & & & ! in between and exclude files starting with underscores.

For instance:

 file:website/css//* && !file:website/css//_* 
+1
source

Source: https://habr.com/ru/post/1481145/


All Articles