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

calc containing variable with fallback not correctly compiled. #81

Closed renestalder closed 5 years ago

renestalder commented 5 years ago

I have many of following lines in my code:

.klt-p-block-team-list__item:first-child {
    margin-top: calc(var(--klt-l-spacing-3, 0) * -1);
}

The build fails in this case.

    ERROR in ./~/css-loader?{"importLoaders":1,"minimize":true}!./~/postcss-loader/lib?{}!./dev/patternlib/source/css/klt-ui.css
    Module build failed: Unclosed bracket (2972:21)

      2970 | }
      2971 | .klt-p-block-team-list__item:first-child {
    > 2972 |     margin-top: calc(20px;
           |                     ^
      2973 | }

Seems like postcss-css-variables generates this output:

.klt-p-block-team-list__item:first-child {
    margin-top: calc(20px;
}

It seems like to pass and compile correctly when removing the fallback variable from var().

MadLittleMods commented 5 years ago

Duplicate of https://github.com/MadLittleMods/postcss-css-variables/issues/62