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 281c581
Browse filesBrowse the repository at this point in the historyBrowse files
feat(html): minify the document an <iframe srcdoc> holds
Adds `optimization.minimize.html.minifySrcdoc`, off by default. The body is a
whole document of its own, so like a conditional comment's it cannot be
minified where it is found: the values are recorded, minified, and put back
into the source, which is then minified as usual. A nested iframe recurses.
Copy file name to clipboardExpand all lines: .changeset/048-html-remove-redundant-attributes.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,4 +2,4 @@
2
2
"webpack": minor
3
3
---
4
4
5
-
Minify HTML further: leave out the implied `<html>` tag and any optional end tag nothing prints behind, print an empty attribute value bare, write an attribute value in the fewest bytes that parse back the same, drop an empty attribute and a run of nested empty elements, fold an enumerated value to lower case, and add the `optimization.minimize.html` options `collapseWhitespace`, `mergeStyles`, `minifyConditionalComments`, `preserveComments`, `removeEmptyAttributes`, `removeEmptyElements`, `removeImpliedTags`, `removeRedundantAttributes`, `sortAttributes` and `sortTokenLists`.
5
+
Minify HTML further: leave out the implied `<html>` tag and any optional end tag nothing prints behind, print an empty attribute value bare, write an attribute value in the fewest bytes that parse back the same, drop an empty attribute and a run of nested empty elements, fold an enumerated value to lower case, and add the `optimization.minimize.html` options `collapseWhitespace`, `mergeStyles`, `minifyConditionalComments`, `minifySrcdoc` (minify the document an `<iframe srcdoc>` holds), `preserveComments`, `removeEmptyAttributes`, `removeEmptyElements`, `removeImpliedTags`, `removeRedundantAttributes`, `sortAttributes` and `sortTokenLists`.
* Minify the document held in an `<iframe srcdoc>` attribute. Off by default: the body is a whole document of its own (its base URL is `about:srcdoc`), so minifying it is safe, but the attribute is readable from script and a consumer comparing `iframe.srcdoc` byte for byte would see it change.
2427
+
* @since 5.110.0
2428
+
*/
2429
+
minifySrcdoc?: boolean;
2425
2430
/**
2426
2431
* Patterns naming comments to keep, on top of the ones minifying always keeps (downlevel conditional comments, server-side includes and template directives). A string is read as a regular expression source and matched against the comment's text.
Copy file name to clipboardExpand all lines: lib/html/htmlMinify.js
+47-3Lines changed: 47 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -23,7 +23,7 @@
23
23
* re-resolves in the worker — via the installed package, or the dev self-link.
24
24
* @param {{ [file: string]: string }} input a single `{ filename: code }` entry
25
25
* @param {(RawSourceMap | undefined)=} sourceMap input source map (unused: safe serialize keeps positions token-coarse, so no map is produced yet)
26
-
* @param {HtmlPrintOptions & { minifyConditionalComments?: boolean }=} minimizerOptions minimizer options — `environment` and `convertLengthUnits` reach the CSS minifier this runs over inline CSS; the rest is `optimization.minimize.html`
26
+
* @param {HtmlPrintOptions & { minifyConditionalComments?: boolean, minifySrcdoc?: boolean }=} minimizerOptions minimizer options — `environment` and `convertLengthUnits` reach the CSS minifier this runs over inline CSS; the rest is `optimization.minimize.html`
Copy file name to clipboardExpand all lines: schemas/WebpackOptions.json
+5Lines changed: 5 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -3781,6 +3781,11 @@
3781
3781
"type": "boolean",
3782
3782
"added": "5.110.0"
3783
3783
},
3784
+
"minifySrcdoc": {
3785
+
"description": "Minify the document held in an `<iframe srcdoc>` attribute. Off by default: the body is a whole document of its own (its base URL is `about:srcdoc`), so minifying it is safe, but the attribute is readable from script and a consumer comparing `iframe.srcdoc` byte for byte would see it change.",
3786
+
"type": "boolean",
3787
+
"added": "5.110.0"
3788
+
},
3784
3789
"preserveComments": {
3785
3790
"description": "Patterns naming comments to keep, on top of the ones minifying always keeps (downlevel conditional comments, server-side includes and template directives). A string is read as a regular expression source and matched against the comment's text.",
"description": "Minify the document held in an \`<iframe srcdoc>\` attribute. Off by default: the body is a whole document of its own (its base URL is \`about:srcdoc\`), so minifying it is safe, but the attribute is readable from script and a consumer comparing \`iframe.srcdoc\` byte for byte would see it change.",
"description": "Minify the document held in an \`<iframe srcdoc>\` attribute. Off by default: the body is a whole document of its own (its base URL is \`about:srcdoc\`), so minifying it is safe, but the attribute is readable from script and a consumer comparing \`iframe.srcdoc\` byte for byte would see it change.",
0 commit comments