Search code examples
cssintellij-ideawebstormfile-watcher

I'd like to combine two css files before compressing with YUI Compressor


I need to combine site.css and theme.css into site.min.css using YUI Compressor or any other plugin as a file watcher on webstorm.

I've already setup the YUI Compressor and I'm able to generate either site.min.css or theme.min.css but not both combined into just one file.

Current file watcher configuration


Solution

  • There is no way to pass multiple files to file watcher, and the YUI Compressor itself doesn't seem to support files merging (https://github.com/yui/yuicompressor/issues/255).

    I can suggest using Grunt or Gulp for this - see grunt-contrib-cssmin, or gulp-uglifycss with gulp-concat. See https://gist.github.com/atelic/8eb577e87a477a0fb411, https://riptutorial.com/gulp/example/13423/concat-and-uglify-js-and-css-files for some examples.

    You can run the tasks using Grunt/Gulp consoles, or configure them as file watchers if you like them to be run on files changing