vaadin / sass-compiler

A Java Sass compiler implementation
53 stars 25 forks source link

Sass interpolation in parameterized selectors throws parsing error #306

Open vaadin-bot opened 8 years ago

vaadin-bot commented 8 years ago

Originally by rsmeds


The sass compiler does not seem to understand sass string interpolation #{$foo} in a parameterized selector like :nth-child(bar).

Example code (that works e.g. in CodePen, but not with vaadin sass compiler) :

$var:1;
span:nth-child(#{$var}) {
   // whatever styles
}

There is an awkward workaround that involves building the entire nth-child selector as a variable, and interpolating that as a whole:

$var: 1;
$selector: "nth-child(#{$var})";
span:#{$selector} {
   // whatever
}

Imported from https://dev.vaadin.com/ issue #19722