Question

Is there a way to configure SASS FileWatcher so it builds a Minified CSS?

I currently configured SASS + YUI Compressor to accomplish this but I would like to do this with pure SASS if possible.

Here are the screenshots of both configurations:

SASS

YUI Compressor CSS

Thanks in advance.

Was it helpful?

Solution

Probably the fastest way to achieve this is to use the compressed option, mentioned in the previous comments, as an argument. The quickest way to configure this in PHPStorm is as follows:

  • Go to File > Settings
  • Inside Project Settings select File Watchers
  • You should already have an SCSS watcher created here (if you have the SCSS watch plugin enabled, PHPStorm prompts you to create a watcher when opening a new .scss file.) Otherwise, enable it (more info about that in this section of the official documentation,) and then create the new watcher pressing the "+" symbol.
  • Double click the watcher name to access its configuration.
  • In the Arguments line make sure to add the --style compressed argument
  • Click OK and you're done

This image shows how that configuration should look:

Compressed SCSS settings in PHPStorm

From that point on, your .css output files will be compressed.

OTHER TIPS

The correct answer is --style=compressed

menu File -> Settings -> Tools - File watchers add scss and in argument add --style=compressed

enter image description here

If you are using sassc under Linux (Arch) you could use as Arguments:

-t compressed -m auto $FileNameWithoutExtension$.scss $FileNameWithoutExtension$.min.css

For me, --style compressed, --style compressed and --style=compressed don't work.

I had to add the option -x as an argument.

Like here: enter image description here

If you want more details this post the following post is where I found this solution: https://stackoverflow.com/a/25579991/9861577.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top