Skip to content

Try our new Crash Courses!

Buy one of our new Crash Courses, now hosted on Podia.

Minify CSS output with Sass

Summary

To minify the CSS output generated by Sass, add the --style=compressed option to your command in the terminal.

Details

If you’re watching a single Sass file, you would enter something similar to the following command into your terminal (your file names may be different):

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

If you’re watching multiple Sass files inside a sass folder into a css folder, your command would look like this:

sass --watch --style=compressed sass:css

If the sass and css folders are inside an assets folder, your command would look like this:

sass --watch --style=compressed assets/sass:assets/css

Note: The --watch flag in the above commands is optional. If you only need to compile the file(s) once, you can leave it out. If you want to compile the file(s) every time you save, keep the flag in your command.

Exercises

There are no exercises for this lesson.

References

Dart Sass Command-Line Interface | Sass Documentation

Back to: Sass Reference