Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to Minify CSS with SCSS File Watcher in PHPStorm IDE

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.

like image 347
achucuan Avatar asked Jul 31 '13 23:07

achucuan


People also ask

What is SCSS in CSS?

SCSS : Syntactically Awesome Style Sheet is the superset of CSS. SCSS is the more advanced version of CSS. SCSS was designed by Hampton Catlin and was developed by Chris Eppstein and Natalie Weizenbaum. Due to its advanced features it is often termed as Sassy CSS.


2 Answers

The correct answer is --style=compressed 

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

enter image description here

like image 34
Farzad.Kamali Avatar answered Oct 02 '22 14:10

Farzad.Kamali


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.

like image 181
E. Serrano Avatar answered Oct 02 '22 14:10

E. Serrano