Skip to content

Commit b797acf

Browse files
committed
Safe set of minification defaults
I've reviewed a few sources and tried to put a safe set of minification defaults that will not break common use cases such as some javascript and CSS use cases. I've used a subset of the "safe" options [from here](https://kangax.github.io/html-minifier/). Options not used are: - Remove redundant attributes (can break styles/JS) - Remove empty attributes (can break styles/JS) - Remove empty elements (if the empty tag is indeed unintended it should be removed from the original) - Minify URLs (seems like it should be at the users discretion to rewrite absolute URLs) This addresses a number of issues: webpack-contrib#40, webpack-contrib#38.
1 parent 5fb1cf3 commit b797acf

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

index.js

+8-4
Original file line numberDiff line numberDiff line change
@@ -62,13 +62,17 @@ module.exports = function(content) {
6262

6363
[
6464
"removeComments",
65+
"removeCommentsFromCDATA",
66+
"removeCDATASectionsFromCDATA",
6567
"collapseWhitespace",
66-
"collapseBooleanAttributes",
68+
"conservativeCollapse",
6769
"removeAttributeQuotes",
68-
"removeRedundantAttributes",
6970
"useShortDoctype",
70-
"removeEmptyAttributes",
71-
"removeOptionalTags"
71+
"keepClosingSlash",
72+
"minifyJS",
73+
"minifyCSS",
74+
"removeScriptTypeAttributes",
75+
"removeStyleTypeAttributes",
7276
].forEach(function(name) {
7377
if (typeof minimizeOptions[name] === "undefined") {
7478
minimizeOptions[name] = true;

0 commit comments

Comments
 (0)