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.

3
  • 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? Commented Mar 21, 2017 at 8: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 stackoverflow.com/a/41483575/783119 or stackoverflow.com/a/30481839/783119 Commented Mar 21, 2017 at 9:55
  • @LazyOne That worked! Thank you. Do you want to put that into an answer for others that might come by here? Commented Mar 23, 2017 at 8:06

1 Answer 1

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.
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.