Repository navigation
Commit 1c4e4a1
committed
perf(css): fold hsl() and hwb() channels written as numbers
CSS Color 4 states the two channels after the hue as `<percentage> | <number>`,
so `hsl(120 50 50)` is the color `hsl(120 50% 50%)` names. The fold required a
`%` on both and declined everything else, leaving 500 css-parsing-tests cases
per function — and any stylesheet written in the modern grammar — unminified.
The separator decides it: only the space-separated form takes a bare number,
where the legacy comma form is percentages alone, so folding `hsl(120, 50, 50)`
would hand invalid CSS a color. The byte-boundary guard is untouched, so a
channel an engine would round either way is still declined.
In minimize-lightningcss-values both spellings now fold to the same rule, so
the duplicate elimination keeps the later one — which is why the output moves
between two labelled entries there.1 parent 432e87e commit 1c4e4a1
7 files changed
Lines changed: 30 additions & 5 deletions
File tree
- .changeset
- lib/css
- test/configCases/css
- minimize-colors
- __snapshots__
- minimize-lightningcss-values/__snapshots__
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9211 | 9211 | | |
9212 | 9212 | | |
9213 | 9213 | | |
9214 | | - | |
| 9214 | + | |
| 9215 | + | |
| 9216 | + | |
| 9217 | + | |
| 9218 | + | |
| 9219 | + | |
| 9220 | + | |
9215 | 9221 | | |
9216 | 9222 | | |
9217 | 9223 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
56 | 56 | | |
57 | 57 | | |
58 | 58 | | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
59 | 63 | | |
60 | 64 | | |
61 | 65 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
56 | 56 | | |
57 | 57 | | |
58 | 58 | | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
59 | 63 | | |
60 | 64 | | |
61 | 65 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
117 | 117 | | |
118 | 118 | | |
119 | 119 | | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
120 | 126 | | |
121 | 127 | | |
122 | 128 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
18 | | - | |
19 | | - | |
| 18 | + | |
| 19 | + | |
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
18 | | - | |
19 | | - | |
| 18 | + | |
| 19 | + | |
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
| |||
0 commit comments