File Watchers and output to a sibling folder



I had excellent experience a couple of years ago with WebStorm and Bootstrap 3 projects. - That time I used to have 'css' and 'less' sibling folders in project root and passed to File Watcher the following:

Arguments: '--no-color $FileName$'

Output paths to refresh: '$FileParentDir$\css\$FileNameWithoutExtension$.css'

Nowadays I have the same project structure but prefix '$FileParentDir$\css\' in 'Output paths to refresh' doesn't help: generated *.css and * files live in 'less' folder.

What magic macro prefix shall I use to win File Watcher for 'Less' in PhpStorm 2018.5 ?

Regards / Mike


Hi there,

Please check the docs: "Output path to refresh" is NOT used for specifying the actual output path. It's for IDE to check for externally generated/modified files (after this file watcher finished running).

What you need to do is to provide output path in actual "Arguments" field -- that's where Less compiler takes such info from. For example:

--no-color $FileName$ $FileParentDir$\css\$FileNameWithoutExtension$.css

(P.S. You can also use just ".." to go folder up in the path, e.g. "..\css\$FileNameWithoutExtension$.css" will do the same in your case).

Obviously, you now need to ensure that "Create output file from stdout" option is disabled under Advanced Options.

NOTE: for better IDE functioning you need to specify the path to generated file(s) in both "Arguments" and and "Output path to refresh" fields.


Thank you.


>lessc --version
lessc 3.0.4





Arguments: --no-color $FileName$ $FileParentDir$\css\$FileNameWithoutExtension$.css
No styles.css in <root>\css

No reaction

Regards / Mike


Screenshots please (all options visible). Works just fine here. Windows 10

$ lessc -v
lessc 3.0.4 (Less Compiler) [JavaScript]


P.S. This is an old test project (File Watcher created like 3 or so years ago) and it has some options enabled/disabled for testing purposes ... but all important stuff (that was mentioned earlier) is set as needed.


Maybe point to exact location of lessc.cmd .

P.S. How to force File Watcher run (without modifying source files):


It works! - Thank you.

Regards / Mike


Please sign in to leave a comment.