libsass
libsass copied to clipboard
Error when using lists in media query
@media ("min-width: " 10px) {
/* here */
}
LibSass 3.4.0 RC1
Error: unclosed parenthesis in media query expression
on line 1 of test.scss
>> @media ("min-width: " 10px) {
--------^
Ruby Sass
@media (min-width: 10px) {
/* here */ }
I have updated this issue with a more reduced test case.
@nex3 is the Ruby Sass behaviour intended, if so, what's happening here? I'm guessing it's just list to string.
Look at it on Sassmeister, the behaviour is also different between 3.3 & 3.4+ Sass 3.3.14
@media ("min-width: " 10px) {
/* here */
}
Sass 3.4.21 & 4.0.0.alpha.1
@media (min-width: 10px) {
/* here */
}
So the logic here is that we parse a media query expression as "(" expression [ ":" expression ]? ")"
and then basically just shove that into an interpolation. After parsing, as far as the later stages know, this was written with explicit #{}
-based interpolation, which means any quotes need to be removed. Hence this behavior.
I'm not super happy with it—in general I don't like that certain types of at-rules are more generous with where SassScript is allowed than others—but it is more or less intended.
Wow is this still open 5 years later. That pretty much means it's never going to be fixed.