I've got Webstorm 7 (on Win7) compiling my .less files into minified css with sourcemaps (using lessc on nodejs v0.10.26, run from a File Watcher in Webstorm), and I can then run autoprefixer on that generated css to automatically insert vendor prefixes.
What I'm not sure how to do, is combine the two steps. Is it possible to chain File Watchers in Webstorm?
Possible approaches:
To compile your code automatically, you need to configure a Sass, Less, or SCSS File Watcher which will track changes to your files and run the compiler. When you open a file, WebStorm checks whether an applicable File Watcher is available in the current project.
Autoprefixer is a PostCSS plugin which parses your CSS and adds vendor prefixes Autoprefixer CSS online Autoprefixer is a PostCSS plugin which parses your CSS and adds vendor prefixes
WebStorm integrates with compilers that translate Sass, Less, and SCSS code into CSS. To use a compiler in WebStorm, you need to configure it as a File Watcher based on the relevant predefined template.
If an applicable File Watcher is configured and enabled in the current project, WebStorm starts the compiler automatically upon the event specified in the New Watcher dialog. If the Auto-save edited files to trigger the watcher checkbox is selected, the File Watcher is invoked as soon as any changes are made to the source code.
There is a plugin for less which does this job without adding a watcher: https://github.com/less/less-plugin-autoprefix
After installation you can add --autoprefix="…"
to your arguments for the output in webstorms file watcher.
yes, it's possible to chain file watchers. The autoprefixer file watcher will listen to css changes and run after less. The first and secong approaches will work too
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With