postcss / postcss-simple-vars

PostCSS plugin for Sass-like variables
MIT License
419 stars 35 forks source link

nested interpolation #53

Closed FourwingsY closed 8 years ago

FourwingsY commented 8 years ago
$color1: red;

/* assume @for loop in postcss-advanced-vars */
$idx: 1;
.color$(idx) {
    color: $(color$(idx));
}

what I expected to be

.color1 {
    color: red;
}

but result

.color1 {
    color: $(color1);
}
ai commented 8 years ago

Thanks for report.

First, you should know that we create PostCSS to avoid programming in CSS :). We believe that CSS should be declarative language. If you want complicated logic, you should move it to JS. So custom plugin with nice readable API will be much better in your case.

But I understand that we should add this feature. I will add it on this/next week (but anyway I will be very happy if noone will use it :D).

ai commented 8 years ago

Done 5b1cb42

ai commented 8 years ago

Released in 3.0 and postcss-mixins 5.0