DEV Community 👩‍💻👨‍💻

vajo
vajo

Posted on

PhpStorm File Watchers

File Watcher is a built-in PhpStorm tool that allows you to automatically run a command-line tool like compilers, formatters, or linters when you change or save a file in the IDE.

This is just a few possibilities of using this great tool.

(No, Gulp is still not dead!)

Compile LESS to CSS (minified)

Program: lessc
Arguments: $FileName$ -x $FileNameWithoutExtension$.min.css

npm install -g less
npm install -g less-plugin-clean-css
Enter fullscreen mode Exit fullscreen mode

Minify JS

Program: uglifyjs
Arguments: $FileName$ -c -m -o $FileNameWithoutExtension$.min.js

npm install -g uglify-js
npm install -g uglify-es
Enter fullscreen mode Exit fullscreen mode

Minify JSON

Program: json-minify
Arguments: $FileName$

Make sure to tick "Create output file from stdout" checkbox.

npm install -g json-minify
Enter fullscreen mode Exit fullscreen mode

Minify HTML

Program: html-minifier
Arguments: $FileName$ --collapse-whitespace --remove-comments -o $FileName$

npm install -g html-minifier
Enter fullscreen mode Exit fullscreen mode

Top comments (0)

🌚 Browsing with dark mode makes you a better developer by a factor of exactly 40.

It's a scientific fact.