File watcher generates empty file from less
Hi, I just started using PHPStorm and I came across an annoying problem - as fas as I looked it up my file watcher is properly configured but running it generates an empty app.css file out of the source less file :/
Here is the config:
<TaskOptions>
<TaskOptions>
<option name="arguments" value="--no-color $FileName$ $ProjectFileDir$/app/$FileNameWithoutExtension$.css" />
<option name="checkSyntaxErrors" value="true" />
<option name="description" />
<option name="exitCodeBehavior" value="ERROR" />
<option name="fileExtension" value="less" />
<option name="immediateSync" value="true" />
<option name="name" value="test Less" />
<option name="output" value="$ProjectFileDir$/app/$FileNameWithoutExtension$.css" />
<option name="outputFilters">
<array>
<FilterInfo>
<option name="description" value="lessc error format" />
<option name="name" value="lessc" />
<option name="regExp" value="$MESSAGE$\Q in \E$FILE_PATH$\Q on line \E$LINE$\Q, column \E$COLUMN$" />
</FilterInfo>
</array>
</option>
<option name="outputFromStdout" value="true" />
<option name="program" value="/usr/local/bin/lessc" />
<option name="scopeName" value="Project Files" />
<option name="trackOnlyRoot" value="false" />
<option name="workingDir" value="$FileDir$" />
<envs />
</TaskOptions>
</TaskOptions>
Problem is generated by <option name="output" value="$ProjectFileDir$/app/$FileNameWithoutExtension$.css" />
If I run similiar command form terminal (/usr/local/bin/lessc --no-color app.less /var/www/angular/test/app/app.css, being in the app.less dir) OR if I remove the "Output paths to refresh" the file is properly generated, otherwise it is always generated empty. Technically I could use it w/o "Output paths to refresh" but I assume its there for a reason (which I admit I don't quite understand - is that used for reloading the file on change??)
Regards,
Lech
Please sign in to leave a comment.
Hi there,
>(which I admit I don't quite understand - is that used for reloading the file on change??)
Yes -- it's so that IDE knows what the generated file is so it gets re-loaded as well. Plus, in the past (2016.2 and older) this info was used for file nesting -- now it's based on hardcoded patterns (hopefully will be made customisable in one of the versions).
You have arguments = "--no-color $FileName$ $ProjectFileDir$/app/$FileNameWithoutExtension$.css" (so you have BOTH source file name as well as output file name) .. but at the same time you have <option name="outputFromStdout" value="true" />
Please disable "Create output file from stdout" file watcher option and try again.
The logic is simple: if you have specified output file name (so LESS compiler will sump the results there) then nothing useful will be sent into actual stdout (which IDE will use -- based on your settings).
Thanks for making it clear. I understand now why it worked with disabled "Output paths to refresh". What got me confused was a post I found where these 2 were mixed (which assured me that both should be set but I did not notice the relation with "Create output file from stdout").
Lecho
Lecho, could you please advise if you've checked our web help? If you did, could you please point to places where it was confusing & hard to understand (besides "Output paths to refresh")?