8Altering the CSS Output

When you compile your Sass, a CSS file is generated. But what if you want that CSS file to be in a slightly different format? We have a few options to choose from. This means you can have your CSS output in a style that you prefer.

In the command line, you can type this:

 
sass --style

Follow this with the name of the style you want. The four options we have are called nested, expanded, compact, and compressed.

Nested is the default output style. It looks very much like regular CSS, with curly braces and semicolons.

Expanded is, as its name suggests, an expanded form of the CSS output. All classes—including nested ones—expand rather than remaining nested in their parents. Both nested and expanded styles are probably ...

Get Pragmatic Guide to Sass now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.