ahnjungho · GitHub

libsass-python document,

output_style (str) – an optional coding style of the compiled result. choose one of: nested (default), expanded, compact, compressed

But there are no differences between nested, expanded, compact output_style of sass.compile. I was puzzled over this parameter.

>>> import sass
>>> scss_str = """nav {
...   ul {
...     margin: 0;
...     padding: 0;
...     list-style: none;
...   }
...
...   li { display: inline-block; }
...
...   a {
...     display: block;
...     padding: 6px 12px;
...     text-decoration: none;
...   }
... }"""
>>> nested = sass.compile(string=scss_str, output_style="nested")
>>> expanded = sass.compile(string=scss_str, output_style="expanded")
>>> compact = sass.compile(string=scss_str, output_style="compact")
>>> compressed = sass.compile(string=scss_str, output_style="compressed")
>>> nested == expanded
True
>>> nested == compact
True
>>> nested == compressed
False
>>>

Thanks.

Read the original on github.com ↗