-
-
Notifications
You must be signed in to change notification settings - Fork 320
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
remove zero units #327
Comments
|
For more information, see: #229 |
Hi @ben-eb — I think I just stumbled on a related issue. I removed Given the following CSS… :root { --wi-gutter: 1rem; };
.test { margin: calc(-.5 * var(--wi-gutter)); } …I noticed cssnano keeps leading zero's. I think they are safe to remove? With .test{margin:-.5rem} With .test{margin:-0.5rem} Is this expected behaviour or a postcss-calc or cssnano issue? |
Hi @davidhund, I guess keeping postcss-calc in the plugins list means that it gets run twice, and so on the second pass the leading zero is stripped out? Unfortunately the way that cssnano works right now is that the values are normalised before postcss-calc runs, but I can't change the order otherwise I have other test cases that are failing. In the meantime I've added this as a pending test case so that I can look to fixing it in a future major release. 48316a4 |
Hi @ben-eb, Thanks for the quick reply. Good point re: running twice! 😉 I understand why you can't simply change the order. It's not a huge issue. One thing I (naively) though of: what about always re-running |
Yeah, this is a possibility but not with the current architecture as duplicate plugins are filtered out. I think it's better to revisit this when I'm doing 4.0. 😄 |
correct minification
%
anddeg
units where they can be safely eliminatedCSSnano output
rotateZ(0)
instead ofrotate()
? what if another rule hasroatateY()
set?height
andmax-height
propertiesdeg
from0deg
%
if final simplification from calc is0%
The text was updated successfully, but these errors were encountered: