Three minification folds: gradient stops, gradient angle, alpha properties - #214
Merged
Conversation
CSS Images 4 sec. 3.4.1 defines the two-position stop as exactly the pair it abbreviates, so the pair was being emitted where the shorter equivalent is always available.
The default direction is that angle turned 180 degrees, so the angle buys nothing once the stops are reversed. Gated on unpositioned stops, whose positions would otherwise each need mirroring, and on the unprefixed gradients, since the legacy ones measure their angle from a different zero.
They parsed as unknown properties, so their values survived as opaque text and missed even leading-zero stripping. Each is an <alpha-value>, so they reuse the opacity reader, printer and normaliser wholesale.
samoht
force-pushed
the
gradient-stop-folding
branch
from
July 29, 2026 18:45
786c304 to
78be5a6
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Three independent gaps, one commit each.
Adjacent gradient stops of one colour now fold into the double-position stop that CSS Images 4 defines as their exact equivalent. A
0deglinear-gradient angle is dropped and the stops reversed, since the default direction is that angle turned 180 degrees; this is gated on stops carrying no position, which the reversal would otherwise have to mirror to100% - p, and never applies to the legacy prefixed gradients, which measure their angle from a different zero.fill-opacityand its three siblings are now modelled as the<alpha-value>they are, instead of parsing as unknown properties whose text survives untouched.The
to topcase in the gradient-direction test changed meaning as a direct consequence of the second commit, so its oracle moved from0degto the reversed form.