hi i have many variables with colors. so want do something like this:
$culture: #00CC66;
$party:#CC9900;
@each $i in culture, party {
.bl_#{$i}{
border-
SASS 3.3 UPDATE
With some new functionality from sass 3.3 you can choose your variable names and do away with the annoying nth()
@each $name, $color in(
'red' $red,
'green' $green,
) {
.color-#{$name} {
background-color: $color;
}
}
ORIGINAL
It's a bit of a pain but you can get by with a list and then for looping through that.
For example:
$colorList:
"red" $red,
"green" $green
;
@each $i in $colorList{
.color-#{nth($i,1)}{
background-color:nth($i,2);
}
}
Having pre defined these color vars elsewhere you get:
.color-red{
background-color:#FF0000
}
.color-green{
background-color:#00FF00
}