NMFR / optimize-css-assets-webpack-plugin

A Webpack plugin to optimize \ minimize CSS assets.
MIT License
1.15k stars 69 forks source link

Incorrect compress on calc() #110

Closed leecjson closed 4 years ago

leecjson commented 5 years ago

calc(1279px - 100px - (100vw - 100%)) will compress to calc(1179px - 100vw - 100%);

btw 100vw not equivalent to 100%

coreyworrell commented 4 years ago

Having a similar issue here as well.

--fluid-bp: calc(
    (var(--fluid-screen) - ((var(--fluid-min-width) / 16) * 1rem)) /
    ((var(--fluid-max-width) / 16) - (var(--fluid-min-width) / 16))
);

compresses to:

--fluid-bp:calc((var(--fluid-screen) - var(--fluid-min-width)/16*1rem)/(var(--fluid-max-width) - var(--fluid-min-width)))

which is missing some of the divisions.

The weirdest part is that the same code on another project (same version) compiles just fine. Not sure why yet.

coreyworrell commented 4 years ago

Real issue lies here: https://github.com/postcss/postcss-calc/issues/107

NMFR commented 4 years ago

Closing, this is a cssProcessor issue (cssnano), i am afraid no change in this repo will help.