sass --watch with automatic minify?

CssSassMinify

Css Problem Overview


Is there a way to run:

sass --watch a.scss:a.css

but have a.css end up being minified?

How would I avoid having to run a separate minification step as I compile my stylesheet?

Css Solutions


Solution 1 - Css

sass --watch a.scss:a.css --style compressed

Consult the documentation for updates:

Solution 2 - Css

If you are using JetBrains editors like IntelliJ IDEA, PhpStorm, WebStorm etc. Use the following settings in Settings > File Watchers. enter image description here

  1. Convert style.scss to style.css set the arguments

     --no-cache --update $FileName$:$FileNameWithoutExtension$.css
    

    and output paths to refresh

     $FileNameWithoutExtension$.css
    
  2. Convert style.scss to compressed style.min.css set the arguments

     --no-cache --update $FileName$:$FileNameWithoutExtension$.min.css --style compressed
    

    and output paths to refresh

     $FileNameWithoutExtension$.min.css
    

Solution 3 - Css

If you're using compass:

compass watch --output-style compressed

Solution 4 - Css

There are some different way to do that

sass --watch --style=compressed main.scss main.css

or

sass --watch a.scss:a.css --style compressed

or

By Using visual studio code extension live sass compiler

see more

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestiontesterView Question on Stackoverflow
Solution 1 - CsstesterView Answer on Stackoverflow
Solution 2 - CssMadan SapkotaView Answer on Stackoverflow
Solution 3 - CssOlivier LoynetView Answer on Stackoverflow
Solution 4 - CssMD SHAYONView Answer on Stackoverflow