libsass icon indicating copy to clipboard operation
libsass copied to clipboard

Error when using lists in media query

Open bencergazda opened this issue 7 years ago • 5 comments

@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 */ }

bencergazda avatar Nov 02 '16 09:11 bencergazda

I have updated this issue with a more reduced test case.

xzyfer avatar Nov 02 '16 12:11 xzyfer

@nex3 is the Ruby Sass behaviour intended, if so, what's happening here? I'm guessing it's just list to string.

xzyfer avatar Nov 02 '16 13:11 xzyfer

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 */
}

nschonni avatar Nov 02 '16 21:11 nschonni

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.

nex3 avatar Nov 08 '16 01:11 nex3

Wow is this still open 5 years later. That pretty much means it's never going to be fixed.

geoidesic avatar Mar 18 '21 23:03 geoidesic