0

There is a --style compressed argument for compile minified css (f.e. compiling minified css described here). But is it possible to compile .css AND .min.css at the same time?

Or I should create separate minify file watcher? (I tried to create 2 scss file watcher, one for .css and second for .min.css, but the second one replaced the first one, and I got only minified css).

Community
  • 1
  • 1
Red
  • 3
  • 2
  • 1
    Unlikely. I mean -- you can write a batch/shell script which does such job and then use it in file watcher -- in this case everything is possible. Well -- instead of batch/shell script -- why not do Gulp/Grunt task and call it from File Watcher -- overall better solution. In any case (traditional approach): create 2 file watchers: one compiles `.scss` file into `.css` and second one (using different tool, perhaps) watches that generated `.css` file and minifies it into `.min.css` -- that is possible as File Watchers get triggered one after another. – LazyOne Dec 08 '16 at 09:50

1 Answers1

3

Possible solutions:

  1. Create 2 files watchers - SCSS->CSS and CSS->MIN.CSS. Use any available CSS uglifier for the second one - YUI Compressor, for example. See https://www.jetbrains.com/help/webstorm/2016.3/minifying-css.html

  2. create a batch script that does the job (calls SCSS compiler for your .scss and then compresses the resultant CSS) and set it up as a file watcher

  3. Use Gulp/Grunt tasks to compile and minify your files. You can either set up Gulp/Grunt as file watchers, or use Gulp/Grunt watch tasks

lena
  • 90,154
  • 11
  • 145
  • 150
  • 2
    P.S. For #1 -- do not forget to only process actual .css files -- the file watcher should use custom scope that would exclude already minified files (`.min.css`) otherwise you will get `.min.min.css` or the same file processed multiple times -- minification of already minified file) – LazyOne Dec 08 '16 at 13:42