PhpStrom's SASS file watcher ignores @import-ed file in CSS generation

Hi, Community.

Let's say, I have such test.scss file:

.test {
  margin: 0;

It is compiled into test.css. Good.

I have another test2.scss with such a code:

.test2 {
padding: 0;

Which is compiled into test2.css. Also good.

But, if I add @import "test"; in test2.scss, then test.css stops compiling.

Official documentation of SASS says:

If you have a SCSS or Sass file that you want to import but don’t want to compile to a CSS file, you can add an underscore to the beginning of the filename.

From this I can understand, that test.css must compile in any case. It's compilation can be disabled only by adding underscore in the beginnig of SCSS filename.

I've asked this question at StackOverflow and have got the advise to try native SCSS watcher. And that worked fine.

This is output of native SCSS watcher, when I change something at test.scss and save:

>>> Change detected to: <abspath>/Resources/Private/Sass/test.scss
  overwrite Css/test.css
  overwrite Css/test2.css

And here is output of PhpStorm's FileWatcher at same situation:

I:/Ruby200/bin/scss.bat --no-cache --update <abspath>/Resources/Private/Sass/test2.scss:../../Public/Css/test2.css --unix-newlines
  overwrite ../../Public/Css/test2.css

Attached you can find screenshot of my File Watcher configuration.

Is it bug of PhpStorm or I'm doing something worng?

Comment actions Permalink

Hi there,

Please un-tick "Track only root files" checkbox -- it does exactly that.

When the File Watcher is invoked on a file, PhpStorm detects all the files in which this file is included. For each of these files, in its turn, PhpStorm again detects the files into which it is included. This operation is repeated recursively until PhpStorm reaches the files that are not included anywhere within the specified scope. These files are referred to as root files (do not confuse with content roots).

  • When this check box is selected the File Watcher runs only against the root files.
  • When the check box is cleared, the File Watcher runs against the file from which it is invoked and against all the files in which this file is included recursively within the specified scope.
Comment actions Permalink

Thank you! As ususal, fast and helpful answer :)


Please sign in to leave a comment.