Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

libsass doesn't preserve new lines in nested style (Ruby Sass does) #552

Closed
mgol opened this issue Oct 17, 2014 · 15 comments
Closed

libsass doesn't preserve new lines in nested style (Ruby Sass does) #552

mgol opened this issue Oct 17, 2014 · 15 comments

Comments

@mgol
Copy link

mgol commented Oct 17, 2014

The following SCSS:

a,
div {
    top: 0;
}

is generated by Sass 3.4.5 to the following CSS (when output style is set to nested):

a,
div {
  top: 0; }

/*# sourceMappingURL=styles.css.map */

Meanwhile, libsass 3.0 converts it to:

/* line 2, /Users/mgol/Documents/projects/bn/cbn/repo/polona-gui/app/styles.scss */
a, div {
  top: 0; }

/*# sourceMappingURL=styles.css.map */

Note that a and div are in the same line in the libsass version.

Another issue with this example: #551

@mgol
Copy link
Author

mgol commented Oct 17, 2014

Ruby Sass preserves other whitespaces as well, if you e.g. have 4 spaces between selectors in SCSS, they remain 4 in the resulting CSS. libsass collapses them to 1 space.

@mgol
Copy link
Author

mgol commented Oct 18, 2014

What does the needs test label mean? I've provided a test case. :)

@HamptonMakes
Copy link
Member

If you checkout the Contribution guide in the wiki, it's so that we can write a sass-spec test case that is "todo"

On Sat, Oct 18, 2014 at 2:32 PM, Michał Gołębiowski
notifications@github.com wrote:

What does the needs test label mean? I've provided a test case. :)

Reply to this email directly or view it on GitHub:
#552 (comment)

@mgol
Copy link
Author

mgol commented Oct 29, 2014

Another example:

Source:

.a,
.b {
    &.c {
        color: red;
    }
}

Ruby Sass output:

.a.c,
.b.c {
  color: red;
}

libsass output:

.a.c, .b.c {
  color: red; }

@mgol
Copy link
Author

mgol commented Oct 30, 2014

A PR to sass-spec: sass/sass-spec#114

@HamptonMakes
Copy link
Member

Hmm... just checked and this seems to be passing now on master. @xzyfer did we change anything?

@xzyfer
Copy link
Contributor

xzyfer commented Nov 6, 2014

This doesn't pass on master for me. I get

Input

a,
div {
    top: 0;
}

.a,
.b {
    &.c {
        color: red;
    }
}

Libsass output

a, div {
  top: 0; }

.a.c, .b.c {
  color: red; }

Ruby sass output

a,
div {
  top: 0; }

.a.c,
.b.c {
  color: red; }

@xzyfer
Copy link
Contributor

xzyfer commented Nov 6, 2014

My guess is the spec is passing due to this issue in sass-spec sass/sass-spec#131

@mgreter
Copy link
Contributor

mgreter commented Mar 2, 2015

The examples here are 100% passing with my latest refactoring! Although there are some other cases where output is not matching exactly and I had to add the "clean" flag to the new tests suite.

@am11
Copy link
Contributor

am11 commented Mar 2, 2015

(I read about the reasoning somewhere libsass issue tracker but forgot what was the consensus). With nested style, libsass converts this:

a{b:c}

to:

a {
  b: c; }

while ruby-sass generates:

a {
  b: c;
}

(with closing parenthesis at new line)

Should this be fixed to conform with the output of ruby-sass?

@mgreter
Copy link
Contributor

mgreter commented Mar 2, 2015

Actually with the latest ruby sass this compiles to

a {
  b: c; }

Your example looks like you're compiling it in expanded mode!?

@am11
Copy link
Contributor

am11 commented Mar 2, 2015

Oh my bad. You are right! I was playing with http://sassmeister.com/, forgot to change to nested. :)

Are there plans to add expanded style in LibSass?

@mgreter
Copy link
Contributor

mgreter commented Mar 2, 2015

Already done in #910

@am11
Copy link
Contributor

am11 commented Mar 2, 2015

I am an idiot. Sorry and thank you for addressing it! :)

@mgreter
Copy link
Contributor

mgreter commented Mar 2, 2015

This should be solved by #910!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants