File tree 4 files changed +32
-2
lines changed
4 files changed +32
-2
lines changed Original file line number Diff line number Diff line change @@ -534,7 +534,7 @@ module.exports = {
534
534
535
535
See [ html-minifier-terser] ( https://github.com/DanielRuf/html-minifier-terser ) 's documentation for more information on the available options.
536
536
537
- The rules can be disabled using the following options in your ` webpack.conf.js `
537
+ The default rules can be overridden using the following options in your ` webpack.conf.js `
538
538
539
539
** webpack.config.js**
540
540
@@ -557,6 +557,32 @@ module.exports = {
557
557
};
558
558
```
559
559
560
+ The default rules can be extended:
561
+
562
+ ** webpack.config.js**
563
+
564
+ ``` js
565
+ const { defaultMinimizerOptions } = require (" html-loader" );
566
+
567
+ module .exports = {
568
+ module: {
569
+ rules: [
570
+ {
571
+ test: / \. html$ / i ,
572
+ loader: " html-loader" ,
573
+ options: {
574
+ minimize: {
575
+ ... defaultMinimizerOptions,
576
+ removeComments: false ,
577
+ collapseWhitespace: false ,
578
+ },
579
+ },
580
+ },
581
+ ],
582
+ },
583
+ };
584
+ ```
585
+
560
586
### ` esModule `
561
587
562
588
Type: ` Boolean `
Original file line number Diff line number Diff line change @@ -2,3 +2,4 @@ const loader = require("./index");
2
2
3
3
module . exports = loader . default ;
4
4
module . exports . raw = loader . raw ;
5
+ module . exports . defaultMinimizerOptions = loader . defaultMinimizerOptions ;
Original file line number Diff line number Diff line change 5
5
getImportCode ,
6
6
getModuleCode ,
7
7
getExportCode ,
8
+ defaultMinimizerOptions ,
8
9
} from "./utils" ;
9
10
10
11
import schema from "./options.json" ;
@@ -52,3 +53,5 @@ export default async function loader(content) {
52
53
53
54
return `${ importCode } ${ moduleCode } ${ exportCode } ` ;
54
55
}
56
+
57
+ export { defaultMinimizerOptions } ;
Original file line number Diff line number Diff line change @@ -496,7 +496,7 @@ function isProductionMode(loaderContext) {
496
496
return loaderContext . mode === "production" || ! loaderContext . mode ;
497
497
}
498
498
499
- const defaultMinimizerOptions = {
499
+ export const defaultMinimizerOptions = {
500
500
caseSensitive : true ,
501
501
// `collapseBooleanAttributes` is not always safe, since this can break CSS attribute selectors and not safe for XHTML
502
502
collapseWhitespace : true ,
You can’t perform that action at this time.
0 commit comments