Kronuz / pyScss

pyScss, a Scss compiler for Python
MIT License
582 stars 141 forks source link

Keep newlines in selectors list with output style "expanded". #280

Open homeworkprod opened 10 years ago

homeworkprod commented 10 years ago

Sass (version 3.2.4) keeps newlines in selectors lists in the "expanded" output style.

Example:

$ echo -e 'h1,\nh2 { font-size: 2rem; }' | /usr/bin/scss --style=expanded                       
h1,
h2 {
  font-size: 2rem;
}

pyScss should do this, too.

According to my interpretation of its README, it should behave as Sass does and thus, this is a bug.

homeworkprod commented 10 years ago

Unfortunately, Sass' documentation of output styles does not contain an example with multiple selectors (and on separate lines).

If found the variable sp on the line at https://github.com/Kronuz/pyScss/blob/master/scss/__init__.py#L1519 to be the source of the space character between the selectors. However, it is also used around the : in property name/value pairs, so just changing it to a newline breaks other stuff; the necessary change thus has to be more than that.

eevee commented 10 years ago

It's even thornier: Ruby Sass only puts newlines between selectors if they were there in the original code. I have no idea where we'd even preserve that information, or what implications it would have for mixins...