@@ -7,6 +7,7 @@ var attrParse = require("./lib/attributesParser");
7
7
var SourceNode = require ( "source-map" ) . SourceNode ;
8
8
var loaderUtils = require ( "loader-utils" ) ;
9
9
var url = require ( "url" ) ;
10
+ var assign = require ( "object-assign" ) ;
10
11
11
12
function randomIdent ( ) {
12
13
return "xxxHTMLLINKxxx" + Math . random ( ) + Math . random ( ) + "xxx" ;
@@ -57,16 +58,24 @@ module.exports = function(content) {
57
58
content . reverse ( ) ;
58
59
content = content . join ( "" ) ;
59
60
if ( typeof query . minimize === "boolean" ? query . minimize : this . minimize ) {
60
- content = htmlMinifier . minify ( content , {
61
- removeComments : query . removeComments !== false ,
62
- collapseWhitespace : query . collapseWhitespace !== false ,
63
- collapseBooleanAttributes : query . collapseBooleanAttributes !== false ,
64
- removeAttributeQuotes : query . removeAttributeQuotes !== false ,
65
- removeRedundantAttributes : query . removeRedundantAttributes !== false ,
66
- useShortDoctype : query . useShortDoctype !== false ,
67
- removeEmptyAttributes : query . removeEmptyAttributes !== false ,
68
- removeOptionalTags : query . removeOptionalTags !== false
61
+ var minimizeOptions = assign ( { } , query ) ;
62
+
63
+ [
64
+ "removeComments" ,
65
+ "collapseWhitespace" ,
66
+ "collapseBooleanAttributes" ,
67
+ "removeAttributeQuotes" ,
68
+ "removeRedundantAttributes" ,
69
+ "useShortDoctype" ,
70
+ "removeEmptyAttributes" ,
71
+ "removeOptionalTags"
72
+ ] . forEach ( function ( name ) {
73
+ if ( typeof minimizeOptions [ name ] === "undefined" ) {
74
+ minimizeOptions [ name ] = true ;
75
+ }
69
76
} ) ;
77
+
78
+ content = htmlMinifier . minify ( content , minimizeOptions ) ;
70
79
}
71
80
return "module.exports = " + JSON . stringify ( content ) . replace ( / x x x H T M L L I N K x x x [ 0 - 9 \. ] + x x x / g, function ( match ) {
72
81
if ( ! data [ match ] ) return match ;
0 commit comments