csstools/postcss-advanced-variables

Variable interpolation inside selectors

Knagis opened this issue · 1 comments

@for $i from 1 through 5 by 2 {
  .width-#{$i} {
    width: #{$i}0em;
  }
}

@for $j from 1 to 5 by 2 {
  .height-#{$j} {
    height: #{$j}0em;
  }
}

This example does not work.

CssSyntaxError: test.css:2:12: Unknown word

It seems that $(i) and $(j) must be used instead.

Thank you for reporting this! PostCSS can’t support this kind of markup without using the PostCSS SCSS Syntax, which I now recommend in v2.3.1. 😄