DEV Community

Cover image for Sass string interpolation
ccsunny
ccsunny

Posted on

Sass string interpolation

// Sass string interpolation syntax is #{VARIABLE} 
$block: ".MyComponent";

#{$block} {
  &-title {
    #{$block}--xmasTheme & {
    }
  }
}

// Compiles to
.MyComponent {}
.MyComponent-title {}
.MyComponent--xmasTheme .MyComponent-title {}
Enter fullscreen mode Exit fullscreen mode

Top comments (0)