Search code examples
idephpstormwebstormjetbrains-ide

How to automatically minify html files in PhpStorm/ WebStorm?


For CSS files I have created a file watcher like described in this manual. Also for JS files, see manual, which both uses the YUI Compressor

But I didn't find how to add file watchers, which minify html files (e.g. removing comments, ..). How can I automatically minify html files with PhpStorm?


Solution

  • I'd suggest looking at HTMLMinifier - it has CLI and thus can be set up as a file watcher, also it can be configured as Grunt task or Gulp task and executed using Grant/Gulp console