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-left-color: #{$#{$i}};
}
}
for print:
bl_culture{border-left-color:#00cc66}
bl_party{border-left-color:#cc9900}
How can ido it?
thanks
As sad as it is, you can't. SASS will only parse your file once, so even if you do something like this :
You will end up with the following CSS :
Your best bet is probably to change your code for something like :
And then use something like
class="bl culture"
instead ofclass="bl_culture"
.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()
ORIGINAL
It's a bit of a pain but you can get by with a list and then for looping through that.
For example:
Having pre defined these color vars elsewhere you get: