Skip to content

Commit 9fd7ef6

Browse files
committed
update html-minifier & fix tests
1 parent 6028f2d commit 9fd7ef6

File tree

3 files changed

+8
-11
lines changed

3 files changed

+8
-11
lines changed

index.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,16 +75,13 @@ module.exports = function(content) {
7575
"useShortDoctype",
7676
"keepClosingSlash",
7777
"removeScriptTypeAttributes",
78-
"removeStyleTypeAttributes",
78+
"removeStyleTypeAttributes"
7979
].forEach(function(name) {
8080
if(typeof minimizeOptions[name] === "undefined") {
8181
minimizeOptions[name] = true;
8282
}
8383
});
8484

85-
// required for Vue 1.0 shorthand syntax
86-
minimizeOptions.customAttrSurround = [[/@/, new RegExp('')], [/:/, new RegExp('')]]
87-
8885
content = htmlMinifier.minify(content, minimizeOptions);
8986
}
9087

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"dependencies": {
77
"es6-templates": "^0.2.2",
88
"fastparse": "^1.0.0",
9-
"html-minifier": "^1.0.0",
9+
"html-minifier": "^1.4.0",
1010
"loader-utils": "~0.2.2",
1111
"object-assign": "^4.0.1"
1212
},

test/loaderTest.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,31 +38,31 @@ describe("loader", function() {
3838
loader.call({
3939
minimize: true
4040
}, '<!-- comment --><h3 customAttr="">#{number} {customer}</h3>\n<p> {title} </p>\n\t <!-- comment --> <img src="image.png" />').should.be.eql(
41-
'module.exports = "<h3 customattr=\\"\\">#{number} {customer}</h3> <p> {title} </p> <img src=\\"\" + require("./image.png") + "\\\"/>";'
41+
'module.exports = "<h3 customattr=\\"\\">#{number} {customer}</h3> <p> {title} </p> <img src=" + require("./image.png") + " />";'
4242
);
4343
});
4444
// https://github.com/webpack/webpack/issues/752
4545
it("should not remove attributes by default", function() {
4646
loader.call({
4747
minimize: true
4848
}, '<input type="text" />').should.be.eql(
49-
'module.exports = "<input type=\\"text\\"/>";'
49+
'module.exports = "<input type=text />";'
5050
);
5151
});
5252
it("should preserve comments", function() {
5353
loader.call({
5454
minimize: true,
5555
query: "?-removeComments"
5656
}, '<!-- comment --><h3 customAttr="">#{number} {customer}</h3><p>{title}</p><!-- comment --><img src="image.png" />').should.be.eql(
57-
'module.exports = "<!-- comment --><h3 customattr=\\"\\">#{number} {customer}</h3><p>{title}</p><!-- comment --><img src=\\"\" + require("./image.png") + "\\\"/>";'
57+
'module.exports = "<!-- comment --><h3 customattr=\\"\\">#{number} {customer}</h3><p>{title}</p><!-- comment --><img src=" + require("./image.png") + " />";'
5858
);
5959
});
6060
it("should treat attributes as case sensitive", function() {
6161
loader.call({
6262
minimize: true,
6363
query: "?caseSensitive"
6464
}, '<!-- comment --><h3 customAttr="">#{number} {customer}</h3><p>{title}</p><!-- comment --><img src="image.png" />').should.be.eql(
65-
'module.exports = "<h3 customAttr=\\"\\">#{number} {customer}</h3><p>{title}</p><img src=\\"\" + require("./image.png") + "\\\"/>";'
65+
'module.exports = "<h3 customAttr=\\"\\">#{number} {customer}</h3><p>{title}</p><img src=" + require("./image.png") + " />";'
6666
);
6767
});
6868
it("should accept complex options via a webpack config property", function() {
@@ -82,8 +82,8 @@ describe("loader", function() {
8282
it('should minimize vue template', function () {
8383
loader.call({
8484
minimize: true
85-
}, '<div :id="test" @click="ok">\n hihihi {{what}} \n</div>').should.be.eql(
86-
'module.exports = "<div :id=test @click=ok> hihihi {{what}} </div>";'
85+
}, '<div :id="test" @click="ok">\n hihihi {{what}} \n</div><button :disabled="ok"></button>').should.be.eql(
86+
'module.exports = "<div :id=test @click=ok> hihihi {{what}} </div><button :disabled=ok></button>";'
8787
);
8888
})
8989
it("should not translate root-relative urls (without root query)", function() {

0 commit comments

Comments
 (0)