Creating or referencing variables dynamically in Sass -


i'm trying use string interpolation on variable reference variable:

// set variable , mixin $foo-baz: 20px;  @mixin do-this($bar) {     width: $foo-#{$bar}; }  // use mixin passing 'baz' string param use $foo-baz variable in mixin @include do-this('baz'); 

but when this, following error:

undefined variable: "$foo-".

does sass support php-style variable variables?

sass not allow variables created or accessed dynamically. however, can use lists similar behavior.

scss:

$medium: 2;  $width: 20px 30px 40px;  @mixin do-this($bar) {   width: nth($width, $bar); }  #smth {   @include do-this($medium); } 

css:

#smth {   width: 30px; } 

Comments

Popular posts from this blog

searchKeyword not working in AngularJS filter -

sequelize.js - Sequelize: sort by enum cases -

user interface - how to replace an ongoing process of image capture from another process call over the same ImageLabel in python's GUI TKinter -