File tree 2 files changed +61
-0
lines changed
2 files changed +61
-0
lines changed Original file line number Diff line number Diff line change @@ -102,6 +102,38 @@ module: {
102
102
}
103
103
```
104
104
105
+ The enabled rules for minimizing by default are the following ones:
106
+ - removeComments
107
+ - removeCommentsFromCDATA
108
+ - removeCDATASectionsFromCDATA
109
+ - collapseWhitespace
110
+ - conservativeCollapse
111
+ - removeAttributeQuotes
112
+ - useShortDoctype
113
+ - keepClosingSlash
114
+ - minifyJS
115
+ - minifyCSS
116
+ - removeScriptTypeAttributes
117
+ - removeStyleTypeAttributes
118
+
119
+ The rules can be disabled using the following options in your ` webpack.conf.js `
120
+
121
+ ``` js
122
+ module: {
123
+ rules: [{
124
+ test: / \. html$ / ,
125
+ use: [ {
126
+ loader: ' html-loader' ,
127
+ options: {
128
+ minimize: true ,
129
+ removeComments: false ,
130
+ collapseWhitespace: false
131
+ }
132
+ }],
133
+ }]
134
+ }
135
+ ```
136
+
105
137
### 'Root-relative' URLs
106
138
107
139
For urls that start with a ` / ` , the default behavior is to not translate them.
Original file line number Diff line number Diff line change @@ -57,6 +57,35 @@ describe("loader", function() {
57
57
'module.exports = "<!-- comment --><h3 customattr=\\"\\">#{number} {customer}</h3><p>{title}</p><!-- comment --><img src=\" + require("./image.png") + \" />";'
58
58
) ;
59
59
} ) ;
60
+
61
+ it ( "should preserve comments and white spaces when minimizing (via webpack config property)" , function ( ) {
62
+ loader . call ( {
63
+ minimize : true ,
64
+ options : {
65
+ htmlLoader : {
66
+ removeComments : false ,
67
+ collapseWhitespace : false
68
+ }
69
+ }
70
+ } , '<!-- comment --><h3 customAttr="">#{number} {customer}</h3><p>{title}</p> <!-- comment --> <img src="image.png" />' ) . should . be . eql (
71
+ 'module.exports = "<!-- comment --><h3 customattr=\\"\\">#{number} {customer}</h3><p>{title}</p> <!-- comment --> <img src=\" + require("./image.png") + \" />";'
72
+ ) ;
73
+ } ) ;
74
+
75
+ it ( "should preserve comments and white spaces when minizing (via webpack config property)" , function ( ) {
76
+ loader . call ( {
77
+ options : {
78
+ htmlLoader : {
79
+ minimize : true ,
80
+ removeComments : false ,
81
+ collapseWhitespace : false
82
+ }
83
+ }
84
+ } , '<!-- comment --><h3 customAttr="">#{number} {customer}</h3><p>{title}</p> <!-- comment --> <img src="image.png" />' ) . should . be . eql (
85
+ 'module.exports = "<!-- comment --><h3 customattr=\\"\\">#{number} {customer}</h3><p>{title}</p> <!-- comment --> <img src=\" + require("./image.png") + \" />";'
86
+ ) ;
87
+ } ) ;
88
+
60
89
it ( "should treat attributes as case sensitive" , function ( ) {
61
90
loader . call ( {
62
91
minimize : true ,
You can’t perform that action at this time.
0 commit comments