postcss/postcss-simple-vars

nested interpolation

FourwingsY opened this issue · 3 comments

$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

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

Done 5b1cb42

ai commented

Released in 3.0 and postcss-mixins 5.0