Skip to content

Commit

Permalink
Safe set of minification defaults
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
chrisnicola committed Dec 17, 2015
1 parent 5fb1cf3 commit b797acf
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,17 @@ module.exports = function(content) {

[
"removeComments",
"removeCommentsFromCDATA",
"removeCDATASectionsFromCDATA",
"collapseWhitespace",
"collapseBooleanAttributes",
"conservativeCollapse",
"removeAttributeQuotes",
"removeRedundantAttributes",
"useShortDoctype",
"removeEmptyAttributes",
"removeOptionalTags"
"keepClosingSlash",
"minifyJS",
"minifyCSS",
"removeScriptTypeAttributes",
"removeStyleTypeAttributes",
].forEach(function(name) {
if (typeof minimizeOptions[name] === "undefined") {
minimizeOptions[name] = true;
Expand Down

0 comments on commit b797acf

Please sign in to comment.