-
Notifications
You must be signed in to change notification settings - Fork 463
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
@at-root with nested ampersand '&' selector compiles differently for Sass Compiler vs Libsass #2358
Comments
classicmike
changed the title
@at-root with deep nested ampersand '&' selector compiles differently for Sass Compiler vs Libsass
@at-root with nested ampersand '&' selector compiles differently for Sass Compiler vs Libsass
May 15, 2017
Hi guys, I submitted this issue about a month ago and I was just wanted to follow up on whether or not this has been looked at or not. I have just edited the issue content just to make it a little more readable with the example code. Thanks for your help. |
Thanks for the report @classicmike. I'm on holidays atm so this hasn't been looked into, however I can confirm the issue with a reduced test case. @at-root .block {
&__element {
&--modifier#{&}--another-modifier {
background: #fff;
}
}
} |
mgreter
added a commit
to mgreter/sass-spec
that referenced
this issue
May 21, 2017
mgreter
added a commit
to mgreter/libsass
that referenced
this issue
May 21, 2017
mgreter
added a commit
that referenced
this issue
May 21, 2017
Improve parent selector handling in selector schema (#2358)
mgreter
added a commit
that referenced
this issue
May 21, 2017
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi,
Currently in my SCSS workflow, I use BEM. I have some SASS code SCSS content which would wrap an @at-root directive and compile out; as well as the '&' selector to concatenate parent selectors, like this:
In order to compile out something like this:
At the time I was using nodesass which from my understanding uses libsass. However, what I found
was with the
@at-root
at the top level, the final compiled CSS was compiled differently as:Upon further testing, if I removed the
@at-root
I would get the correct expected output.To make sure I can verify this potential issue, I fired up Sassmeister to test a few things and found out the very same SCSS compiled differently when using the Sass Compiler with Compass (As per above correct expected output correctly compiling
.block__element--modifier.block__element--another-modifier
) vs Libsass (As per above incorrect output under NodeSass incorrect compiling.block .block__element--modifier.block .block__element--another-modifier
).Below is a list of links with the Gists for the full tests on both compilers with the SCSS code I used and the compile results for each. Version information should be present in both.
If my understanding of the way how you use '&' and 'at-root' is correct as in the examples, the Libsass implementation seems to be doing it incorrectly. Whilst I have tested it on specific a specific version of each compiler, I feel the problem can be also be seen in the latest stable version of Libsass.
If you can look into this that would be great as my project at the moment sort of depends on it.
Thanks.
The text was updated successfully, but these errors were encountered: