feat: improved serialization of the `rotate` property (#1147)
This PR refactors the serialization of the `rotate` property value according to the CSS Transforms 2 specification.
Previously, `rotate: 0deg` was incorrectly serialized as `rotate: none`. The specification clearly states that `rotate: 0deg` creates a stacking context and containing block, while `rotate: none` does not.
See Demo: https://codepen.io/yisi/pen/QwEJEmr?editors=0100
> All three properties accept (and default to) the value none, which produces no transform at all. In particular, this value does not trigger the creation of a stacking context or containing block for all descendants, while all other values (including “identity” transforms like translate: 0px) create a stacking context and containing block for all descendants, per usual for transforms.
> https://drafts.csswg.org/css-transforms-2/#valdef-translate-none
This PR fixes this issue and also provides additional compression benefits.
- `minify_test(".foo { rotate: -0deg }", ".foo{rotate:0deg}");`
- `minify_test(".foo { rotate: z 10deg }", ".foo{rotate:10deg}");`
- `minify_test(".foo { rotate: 0 0 1 10deg }", ".foo{rotate:10deg}");`
- `minify_test(".foo { rotate: 10deg 0 0 -1 }", ".foo{rotate:-10deg}");`
Fixes: https://github.com/parcel-bundler/lightningcss/issues/1136 一
一丝 committed
89d56f67baddb8a3f8aa2673b4a972cebaff6c4a
Parent: 3136cbb
Committed by GitHub <noreply@github.com>
on 2/18/2026, 6:16:06 PM