New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bug]: Calc with css custom properties and brackets #1501
Comments
Isn't this behaviour correct? Subtracting the sum should be the same as subtracting first one term, then the other. For example,
Doe something change visually after minification? |
Or maybe it breaks because the custom properties contain arithmetic expressions (like |
Yeah, it is tricky, maybe we can replace it on |
How could we access the value of the variable? I don't think any of the plugins track that. I think we must skip the transform. There's even a test for that: https://github.com/postcss/postcss-calc/blob/102ba44759794bdf16ac2fa9ef2d1baed7156a45/test/index.js#L200 But the tests themselves contradict each other, because later on they assert that that values containing custom properties must be transformed: https://github.com/postcss/postcss-calc/blob/102ba44759794bdf16ac2fa9ef2d1baed7156a45/test/index.js#L106 There's a function that tries to check for custom properties, but it seems like it lets too many cases through: https://github.com/postcss/postcss-calc/blob/102ba44759794bdf16ac2fa9ef2d1baed7156a45/src/lib/reducer.js#L322 |
Yeah, in theory we can rewrite it on recursive call and do deep check, anyway I think plugin itself should not do modifications when |
Describe the bug
Bracket are removed from calc. And plus changed to minus.
Here is a codepen to see the difference: https://codepen.io/hendrik___/full/YzJdRXm
Expected behaviour
Steps to reproduce
settings: default or advanced
Version
6.0.1
Preset
default
Environment
Package details
Additional context
No response
The text was updated successfully, but these errors were encountered: