From 909b811d70d0065a81fa36e173e99097b96f6c37 Mon Sep 17 00:00:00 2001 From: Simen Bekkhus Date: Fri, 14 Aug 2015 08:57:46 +0200 Subject: [PATCH] Passing true to minify does nothing All `html-minifier` options are `false` by default, so passing just true does nothing to the output --- README.md | 2 +- index.js | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index eef386c..dca91a7 100644 --- a/README.md +++ b/README.md @@ -67,7 +67,7 @@ Allowed values are as follows: - `templateContent`: A html string or a function returning the html (supports [blueimp templates](https://github.com/blueimp/JavaScript-Templates)). - `inject`: `true | 'head' | 'body' | false` Inject all assets into the given `template` or `templateContent` - When passing `true` or `'body'` all javascript resources will be placed at the bottom of the body element. `'head'` will place the scripts in the head element. - `favicon`: Adds the given favicon path to the output html. -- `minify`: `true | {...} | false` Set to true or pass a [html-minifier](https://github.com/kangax/html-minifier#options-quick-reference) options object to minify the output. +- `minify`: `{...} | false` Pass a [html-minifier](https://github.com/kangax/html-minifier#options-quick-reference) options object to minify the output. - `hash`: `true | false` if `true` then append a unique webpack compilation hash to all included scripts and css files. This is useful for cache busting. - `chunks`: Allows you to add only some chunks (e.g. only the unit-test chunk) diff --git a/index.js b/index.js index 59d2834..f014fc8 100644 --- a/index.js +++ b/index.js @@ -130,9 +130,7 @@ HtmlWebpackPlugin.prototype.emitHtml = function(compilation, htmlTemplateContent // Minify the html output if (this.options.minify) { var minify = require('html-minifier').minify; - // If `options.minify` is set to true use the default minify options - var minifyOptions = _.isObject(this.options.minify) ? this.options.minify : {}; - html = minify(html, minifyOptions); + html = minify(html, this.options.minify); } compilation.assets[outputFilename] = {