1

I have the following file structure:

--public_html/
  - css/
  - less/
    - _mixins.less
    - _variables.less
    - _theme.less
    - main.less

I am using PhpStorm with a File Watcher running LESSC from NPM.

My file watcher is as follows:

Program: /usr/local/bin/lessc
Arguments: --no-color $FileName$
Output paths to refresh: ../$FileNameWithoutExtention$.css

Files:

main.less:

@import "_variables.less";
@import "_mixins.less";
@import "_theme.less";

_theme.less contains my stylsheet and _variables.less and _mixins.less are all pretty self explanatory.

When I modify and save main.less The file main.css is created in the css folder as it should.

However, when I edit my _theme.less file, LESSC creates a _theme.css file, also.

How do I stop these extra files being created?

If you need any more info, please ask.

LazyOne
  • 158,824
  • 45
  • 388
  • 391
Wildcard27
  • 1,437
  • 18
  • 48
  • 1
    The filewatcher reacts to changes in individual files and this line compiles the changed files: `Arguments: --no-color $FileName$`. Notice the file name variable. You would need to hardcode the root file there. Have you tried `Arguments: --no-color /path/to/public_html/less/main.less`? – mingos Mar 21 '17 at 08:24
  • 2
    Ensure that `Track only root files` option is enabled (in that File Watcher settings). It works just fine here on Windows 10. See http://stackoverflow.com/a/41483575/783119 or http://stackoverflow.com/a/30481839/783119 – LazyOne Mar 21 '17 at 09:55
  • @LazyOne That worked! Thank you. Do you want to put that into an answer for others that might come by here? – Wildcard27 Mar 23 '17 at 08:06

1 Answers1

1

Please ensure that Track only root files option is enabled in that particular File Watcher settings -- it does just that.

From https://www.jetbrains.com/help/phpstorm/2016.3/new-watcher-dialog.html#d199014e291

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.
LazyOne
  • 158,824
  • 45
  • 388
  • 391