MadLittleMods / postcss-css-variables

PostCSS plugin to transform CSS Custom Properties(CSS variables) syntax into a static representation
https://madlittlemods.github.io/postcss-css-variables/playground/
Other
536 stars 62 forks source link

Inherited calculation not using correctly scoped variable #41

Open urrri opened 7 years ago

urrri commented 7 years ago

I enter following:

:root {
    --aaa: 2;
    --bbb: calc(var(--aaa) * 2);
}

.btn {
    --aaa: 3;
    width: var(--aaa);
    height: var(--bbb);
}

.btn:hover {
    --aaa: 4;
}

and receive:

.btn {
    width: 3;
    height: calc(4 * 2); /*here is the error, it should be 3*2*/
}

.btn:hover {
    height: calc(4 * 2);
}

.btn:hover {
    width: 4;
}