Skip to content

Commit 1a0980e

Browse files
fix(config): leave minimize.css to the css assets, and refresh the cli snapshot
`minimize.css: false` selects which asset types are minimized, not whether CSS is rewritten anywhere: `configCases/optimization/minimize-html-only` states that a disabled type carries no options to forward, and its inline css still minifies. `minimize.html.minifyStyles: false` is the switch for that, which this branch is what adds. The cli flags are derived from the schema, so the `comments` description moves `Cli.basictest`'s snapshot with it.
1 parent a65a583 commit 1a0980e

8 files changed

Lines changed: 6 additions & 87 deletions

File tree

‎lib/config/defaults.js‎

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2565,16 +2565,10 @@ const applyOptimizationDefaults = (
25652565
// beside the HTML options: the two name some of the same switches
25662566
// (`quotes`, `comments`), and one flat object would hand
25672567
// each language the other's answer.
2568-
// An inline `<style>` and a `style=""` are CSS, so `minimize.css`
2569-
// turning the CSS minifier off has to reach them too.
2570-
const minifyStyles =
2571-
minimizeByType.css !== false &&
2572-
(htmlOptions === undefined || htmlOptions.minifyStyles !== false);
25732568
minimizerOptions.push({
25742569
environment: cssEnvironment,
25752570
css: cssOptions,
2576-
...htmlOptions,
2577-
minifyStyles
2571+
...htmlOptions
25782572
});
25792573
extensions.push("html");
25802574
}

‎test/__snapshots__/Cli.basictest.js.snap‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11092,7 +11092,7 @@ Object {
1109211092
"optimization-minimize-css-comments": Object {
1109311093
"configs": Array [
1109411094
Object {
11095-
"description": "Which comments survive. \`\\"some\\"\`, the default, keeps a \`/*!\` banner and a comment annotated \`@license\` or \`@preserve\`; \`true\` (or \`\\"all\\"\`) keeps every comment and \`false\` keeps none; a string is read as a regular expression source, and it, a \`RegExp\` or a \`(comment) => boolean\` predicate is asked about each comment's own text and keeps the ones it accepts — standing in for the default rule rather than beside it, as terser's \`format.comments\` does, so a pattern that names nothing else drops the ones \`\\"some\\"\` would have kept. A \`/*#\` source-map pragma is a link rather than a comment and stays whatever this says. A predicate is handed to the minimizer's worker pool as source, so it must not close over anything.",
11095+
"description": "Which comments survive. \`\\"some\\"\`, the default, keeps a \`/*!\` banner and a comment annotated \`@license\` or \`@preserve\`; \`true\` (or \`\\"all\\"\`) keeps every comment and \`false\` keeps none; a string is read as a regular expression source, and it, a \`RegExp\` or a \`(comment) => boolean\` predicate is asked about each comment's own text and keeps the ones it accepts — standing in for the default rule rather than beside it, as terser's \`format.comments\` does, so a pattern that names nothing else drops the ones \`\\"some\\"\` would have kept. A \`/*#\` source-map pragma is a link rather than a comment, so \`\\"some\\"\` and \`\\"all\\"\` keep it; \`false\`, a pattern or a predicate decides it like any other. A predicate is handed to the minimizer's worker pool as source, so it must not close over anything.",
1109611096
"multiple": false,
1109711097
"path": "optimization.minimize.css.comments",
1109811098
"type": "enum",
@@ -11102,25 +11102,25 @@ Object {
1110211102
],
1110311103
},
1110411104
Object {
11105-
"description": "Which comments survive. \`\\"some\\"\`, the default, keeps a \`/*!\` banner and a comment annotated \`@license\` or \`@preserve\`; \`true\` (or \`\\"all\\"\`) keeps every comment and \`false\` keeps none; a string is read as a regular expression source, and it, a \`RegExp\` or a \`(comment) => boolean\` predicate is asked about each comment's own text and keeps the ones it accepts — standing in for the default rule rather than beside it, as terser's \`format.comments\` does, so a pattern that names nothing else drops the ones \`\\"some\\"\` would have kept. A \`/*#\` source-map pragma is a link rather than a comment and stays whatever this says. A predicate is handed to the minimizer's worker pool as source, so it must not close over anything.",
11105+
"description": "Which comments survive. \`\\"some\\"\`, the default, keeps a \`/*!\` banner and a comment annotated \`@license\` or \`@preserve\`; \`true\` (or \`\\"all\\"\`) keeps every comment and \`false\` keeps none; a string is read as a regular expression source, and it, a \`RegExp\` or a \`(comment) => boolean\` predicate is asked about each comment's own text and keeps the ones it accepts — standing in for the default rule rather than beside it, as terser's \`format.comments\` does, so a pattern that names nothing else drops the ones \`\\"some\\"\` would have kept. A \`/*#\` source-map pragma is a link rather than a comment, so \`\\"some\\"\` and \`\\"all\\"\` keep it; \`false\`, a pattern or a predicate decides it like any other. A predicate is handed to the minimizer's worker pool as source, so it must not close over anything.",
1110611106
"multiple": false,
1110711107
"path": "optimization.minimize.css.comments",
1110811108
"type": "RegExp",
1110911109
},
1111011110
Object {
11111-
"description": "Which comments survive. \`\\"some\\"\`, the default, keeps a \`/*!\` banner and a comment annotated \`@license\` or \`@preserve\`; \`true\` (or \`\\"all\\"\`) keeps every comment and \`false\` keeps none; a string is read as a regular expression source, and it, a \`RegExp\` or a \`(comment) => boolean\` predicate is asked about each comment's own text and keeps the ones it accepts — standing in for the default rule rather than beside it, as terser's \`format.comments\` does, so a pattern that names nothing else drops the ones \`\\"some\\"\` would have kept. A \`/*#\` source-map pragma is a link rather than a comment and stays whatever this says. A predicate is handed to the minimizer's worker pool as source, so it must not close over anything.",
11111+
"description": "Which comments survive. \`\\"some\\"\`, the default, keeps a \`/*!\` banner and a comment annotated \`@license\` or \`@preserve\`; \`true\` (or \`\\"all\\"\`) keeps every comment and \`false\` keeps none; a string is read as a regular expression source, and it, a \`RegExp\` or a \`(comment) => boolean\` predicate is asked about each comment's own text and keeps the ones it accepts — standing in for the default rule rather than beside it, as terser's \`format.comments\` does, so a pattern that names nothing else drops the ones \`\\"some\\"\` would have kept. A \`/*#\` source-map pragma is a link rather than a comment, so \`\\"some\\"\` and \`\\"all\\"\` keep it; \`false\`, a pattern or a predicate decides it like any other. A predicate is handed to the minimizer's worker pool as source, so it must not close over anything.",
1111211112
"multiple": false,
1111311113
"path": "optimization.minimize.css.comments",
1111411114
"type": "boolean",
1111511115
},
1111611116
Object {
11117-
"description": "Which comments survive. \`\\"some\\"\`, the default, keeps a \`/*!\` banner and a comment annotated \`@license\` or \`@preserve\`; \`true\` (or \`\\"all\\"\`) keeps every comment and \`false\` keeps none; a string is read as a regular expression source, and it, a \`RegExp\` or a \`(comment) => boolean\` predicate is asked about each comment's own text and keeps the ones it accepts — standing in for the default rule rather than beside it, as terser's \`format.comments\` does, so a pattern that names nothing else drops the ones \`\\"some\\"\` would have kept. A \`/*#\` source-map pragma is a link rather than a comment and stays whatever this says. A predicate is handed to the minimizer's worker pool as source, so it must not close over anything.",
11117+
"description": "Which comments survive. \`\\"some\\"\`, the default, keeps a \`/*!\` banner and a comment annotated \`@license\` or \`@preserve\`; \`true\` (or \`\\"all\\"\`) keeps every comment and \`false\` keeps none; a string is read as a regular expression source, and it, a \`RegExp\` or a \`(comment) => boolean\` predicate is asked about each comment's own text and keeps the ones it accepts — standing in for the default rule rather than beside it, as terser's \`format.comments\` does, so a pattern that names nothing else drops the ones \`\\"some\\"\` would have kept. A \`/*#\` source-map pragma is a link rather than a comment, so \`\\"some\\"\` and \`\\"all\\"\` keep it; \`false\`, a pattern or a predicate decides it like any other. A predicate is handed to the minimizer's worker pool as source, so it must not close over anything.",
1111811118
"multiple": false,
1111911119
"path": "optimization.minimize.css.comments",
1112011120
"type": "string",
1112111121
},
1112211122
],
11123-
"description": "Which comments survive. \`\\"some\\"\`, the default, keeps a \`/*!\` banner and a comment annotated \`@license\` or \`@preserve\`; \`true\` (or \`\\"all\\"\`) keeps every comment and \`false\` keeps none; a string is read as a regular expression source, and it, a \`RegExp\` or a \`(comment) => boolean\` predicate is asked about each comment's own text and keeps the ones it accepts — standing in for the default rule rather than beside it, as terser's \`format.comments\` does, so a pattern that names nothing else drops the ones \`\\"some\\"\` would have kept. A \`/*#\` source-map pragma is a link rather than a comment and stays whatever this says. A predicate is handed to the minimizer's worker pool as source, so it must not close over anything.",
11123+
"description": "Which comments survive. \`\\"some\\"\`, the default, keeps a \`/*!\` banner and a comment annotated \`@license\` or \`@preserve\`; \`true\` (or \`\\"all\\"\`) keeps every comment and \`false\` keeps none; a string is read as a regular expression source, and it, a \`RegExp\` or a \`(comment) => boolean\` predicate is asked about each comment's own text and keeps the ones it accepts — standing in for the default rule rather than beside it, as terser's \`format.comments\` does, so a pattern that names nothing else drops the ones \`\\"some\\"\` would have kept. A \`/*#\` source-map pragma is a link rather than a comment, so \`\\"some\\"\` and \`\\"all\\"\` keep it; \`false\`, a pattern or a predicate decides it like any other. A predicate is handed to the minimizer's worker pool as source, so it must not close over anything.",
1112411124
"multiple": false,
1112511125
"simpleType": "string",
1112611126
},

‎test/configCases/html/minimize-css-off/__snapshots__/ConfigCacheTest.snap‎

Lines changed: 0 additions & 11 deletions
This file was deleted.

‎test/configCases/html/minimize-css-off/__snapshots__/ConfigTest.snap‎

Lines changed: 0 additions & 11 deletions
This file was deleted.

‎test/configCases/html/minimize-css-off/index.js‎

Lines changed: 0 additions & 6 deletions
This file was deleted.

‎test/configCases/html/minimize-css-off/page.html‎

Lines changed: 0 additions & 8 deletions
This file was deleted.

‎test/configCases/html/minimize-css-off/test.config.js‎

Lines changed: 0 additions & 21 deletions
This file was deleted.

‎test/configCases/html/minimize-css-off/webpack.config.js‎

Lines changed: 0 additions & 18 deletions
This file was deleted.

0 commit comments

Comments
 (0)