Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Less File Watcher - Ignore certain files

I'm using the Less.css File Watcher with WebStorms and I would like to exclude specific files for compilation. I have one style.less file that includes all other CSS and only this file should be compiled. How can I do that?

like image 949
johnny Avatar asked Nov 25 '13 14:11

johnny


People also ask

How do I add files to watcher?

Creating a File WatcherIn the Settings/Preferences dialog ( Ctrl+Alt+S ), click File Watchers under Tools. The File Watchers page opens showing a list of File Watchers that are already configured in this project and in the IDE. and choose the predefined template from which you want to create a File Watcher.

How do I enable file watcher?

Automatically run file watchers on savePress Ctrl+Alt+S to open the IDE settings and select Tools | Actions on Save. Enable the File Watcher option and apply the changes.

What is file watcher in WebStorm?

A File Watcher is a WebStorm system that tracks changes to your files and runs a third-party standalone application. WebStorm provides predefined File Watcher templates for a number of such standard popular third-party tools (compilers, compressors, prettifiers, and others).


1 Answers

If you need the file watcher to watch changes in a single .less file only, ignoring all changes in other .less files, this can be done using Scopes:

  • In Settings/Scopes add your custom scope, with needed files/folders excluded (see Scopes (Phpstorm Help) for more info).

  • In Settings/File Watchers, open your LESS file watcher settings and change the 'Scope' property value from 'Project Files' to your custom scope.

If you need changes in all less files being watched, but have a single style.css generated that would include the styles from all .less files throughout the project, tick 'Track only root files' checkbox in your watcher settings. See the explanation in Help:

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
like image 167
lena Avatar answered Oct 13 '22 02:10

lena