1

I am working on a sass framework that has a list of variables to turn on and off features.

For example:

// atoms:

   $use-pa: true;
   $use-pt: true;
   $use-pb: true;

I want to be able to do something like the following in case a variable was turned off.

@mixin requires($collection: ()) {

    @each $var in $collection {

        #{$var}: true;

    }
}

and

@include requires((

    $use-pa,

    $use-pt,

    $use-pb

));

I am looking for a way to change a variable's value by its name... if possible. #{} does not work.

Eric Harms
  • 569
  • 5
  • 17
  • possible duplicate of [Is it possible to reference a variable with an interpolated string?](http://stackoverflow.com/questions/6010013/is-it-possible-to-reference-a-variable-with-an-interpolated-string) – cimmanon Jun 26 '14 at 20:50
  • You can use maps http://viget.com/extend/sass-maps-are-awesome – JAre Jun 26 '14 at 21:11

1 Answers1

0

If you just want to change the variable's value, don't use interpolation. Here's a sassmeister for you to play with.

Ari
  • 1,595
  • 12
  • 20