You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 0078d85
Browse filesBrowse the repository at this point in the historyBrowse files
feat(css): put case folding and escape rewriting under options
Both rewrote a stylesheet with every option already off, so a caller
asking the printer to change nothing still got a changed sheet. Over the
repository's 619 stylesheets that closes 29 of the 42 that did not round
trip, leaving `!important` (a keyword the printer writes rather than
copies), a `data:` payload's percent escapes, and error recovery.
* Write a name that matches ASCII case-insensitively in lowercase: an at-rule name, a property name, a pseudo-class or pseudo-element name, a function name, a unit, and a keyword standing in a value whose grammar takes keywords alone. `@MEDIA`, `COLOR`, `:NTH-CHILD`, `URL(`, `1PX` and `currentColor` become `@media`, `color`, `:nth-child`, `url(`, `1px` and `currentcolor`. On by default, and exact: CSS matches every one of these ASCII case-insensitively, so the fold names the same thing. What it never touches is a name the author chose — a custom property, a custom ident such as an animation or grid-area name, an id, a class, a type selector, an attribute's value, or anything inside a substituted value. `@charset` is left as written, being read as bytes rather than matched, and `!important` is always written in lowercase because the printer writes the keyword rather than copying it.
2438
+
* @since 5.111.0
2439
+
*/
2440
+
foldCase?: boolean;
2436
2441
/**
2437
2442
* Write a spelling the `browserslist` target cannot read as one it can — the same value said another way, rather than left for an engine that will drop it: a 4-/8-digit hex as `rgba()`, a double-position gradient stop as the two stops it names, `inset` / `overflow` / `place-*` as the longhands they set, `text-decoration` as its own longhands where a slot is newer than the shorthand, `system-ui` as the stack of platform font names it stands for, a `:lang()` or `:not()` holding a list as the `:is()` that means it, a media feature range as the `min-`/`max-` pair, and `light-dark()` as the custom-property pair a color scheme switches. On by default, and only in effect for a `browserslist` target — any other target names no browsers to answer for. Off leaves every such spelling as written, which is how a stylesheet one of these rewrites gets wrong is minified; it never makes the minifier write a spelling the target cannot read.
* Write an escaped identifier the shortest way that names the same thing, in a value or an id: `grid-area:\66oot` becomes `grid-area:foot` and `#\41 x` becomes `#Ax`. On by default, and exact: the escape and what replaces it are the same identifier. Off leaves every escape as the author wrote it, which is what a consumer comparing the text rather than reading the identifier needs.
2498
+
* @since 5.111.0
2499
+
*/
2500
+
rewriteEscapes?: boolean;
2491
2501
/**
2492
2502
* Write each color in the shortest spelling of the same value: `#ffffff` -> `#fff`, `rgb(1 2 3)` -> `#010203`, a named color where the property takes no identifier of the author's own, and every polar and Lab function the target agrees with hex on. On by default.
* @property {boolean=} colorFallbacks write a color the target cannot read as an extra declaration before it, in a spelling it does read
4064
4064
* @property {boolean=} lowerUnsupported write a spelling the target cannot read as one it can — the same value, said another way
4065
+
* @property {boolean=} foldCase write a name that matches ASCII case-insensitively — an at-rule, property, pseudo, function, unit or keyword — in lowercase
4066
+
* @property {boolean=} rewriteEscapes write an escaped identifier the shortest way that names it, in a value or an id
4065
4067
* @property {(boolean | "all" | "some" | string | RegExp | ((comment: string) => boolean))=} comments which comments survive: `"some"` (the default) the ones that carry something, `true` / `"all"` every one, `false` none, or the ones a pattern matches / a predicate accepts, over the comment's own text
4066
4068
* @property {boolean=} resolveCustomAtRules write the query or selector list a `@custom-media` / `@custom-selector` names wherever one asks for it, and drop the rule that named it
4067
4069
* @property {boolean=} mergeLonghands write a family of longhands as the one shorthand that sets them
Copy file name to clipboardExpand all lines: schemas/WebpackOptions.json
+10Lines changed: 10 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -3764,6 +3764,11 @@
3764
3764
"type": "boolean",
3765
3765
"added": "5.110.0"
3766
3766
},
3767
+
"foldCase": {
3768
+
"description": "Write a name that matches ASCII case-insensitively in lowercase: an at-rule name, a property name, a pseudo-class or pseudo-element name, a function name, a unit, and a keyword standing in a value whose grammar takes keywords alone. `@MEDIA`, `COLOR`, `:NTH-CHILD`, `URL(`, `1PX` and `currentColor` become `@media`, `color`, `:nth-child`, `url(`, `1px` and `currentcolor`. On by default, and exact: CSS matches every one of these ASCII case-insensitively, so the fold names the same thing. What it never touches is a name the author chose — a custom property, a custom ident such as an animation or grid-area name, an id, a class, a type selector, an attribute's value, or anything inside a substituted value. `@charset` is left as written, being read as bytes rather than matched, and `!important` is always written in lowercase because the printer writes the keyword rather than copying it.",
3769
+
"type": "boolean",
3770
+
"added": "5.111.0"
3771
+
},
3767
3772
"lowerUnsupported": {
3768
3773
"description": "Write a spelling the `browserslist` target cannot read as one it can — the same value said another way, rather than left for an engine that will drop it: a 4-/8-digit hex as `rgba()`, a double-position gradient stop as the two stops it names, `inset` / `overflow` / `place-*` as the longhands they set, `text-decoration` as its own longhands where a slot is newer than the shorthand, `system-ui` as the stack of platform font names it stands for, a `:lang()` or `:not()` holding a list as the `:is()` that means it, a media feature range as the `min-`/`max-` pair, and `light-dark()` as the custom-property pair a color scheme switches. On by default, and only in effect for a `browserslist` target — any other target names no browsers to answer for. Off leaves every such spelling as written, which is how a stylesheet one of these rewrites gets wrong is minified; it never makes the minifier write a spelling the target cannot read.",
3769
3774
"type": "boolean",
@@ -3819,6 +3824,11 @@
3819
3824
"type": "boolean",
3820
3825
"added": "5.111.0"
3821
3826
},
3827
+
"rewriteEscapes": {
3828
+
"description": "Write an escaped identifier the shortest way that names the same thing, in a value or an id: `grid-area:\\66oot` becomes `grid-area:foot` and `#\\41 x` becomes `#Ax`. On by default, and exact: the escape and what replaces it are the same identifier. Off leaves every escape as the author wrote it, which is what a consumer comparing the text rather than reading the identifier needs.",
3829
+
"type": "boolean",
3830
+
"added": "5.111.0"
3831
+
},
3822
3832
"shortenColors": {
3823
3833
"description": "Write each color in the shortest spelling of the same value: `#ffffff` -> `#fff`, `rgb(1 2 3)` -> `#010203`, a named color where the property takes no identifier of the author's own, and every polar and Lab function the target agrees with hex on. On by default.",
0 commit comments