How to Minify CSS with SCSS File Watcher in PHPStorm IDE

28,740

Solution 1

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.

Solution 2

The correct answer is --style=compressed

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

enter image description here

Share:
28,740
achucuan
Author by

achucuan

Updated on January 18, 2021

Comments

  • achucuan
    achucuan over 3 years

    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.