From 8b97335192d752973e4a9b5877bda8ec3835f808 Mon Sep 17 00:00:00 2001 From: Sebastien Barre Date: Sat, 4 Apr 2015 13:27:49 -0400 Subject: [PATCH] Add support for minification using html-minifier --- index.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/index.js b/index.js index 22c7e20..1242c4b 100644 --- a/index.js +++ b/index.js @@ -113,6 +113,13 @@ HtmlWebpackPlugin.prototype.emitHtml = function(compilation, htmlTemplateContent if (this.options.inject) { html = this.injectAssetsIntoHtml(html, templateParams); } + + if (templateParams.htmlWebpackPlugin.options.minify) { + var minify = require('html-minifier').minify; + var minify_options = templateParams.htmlWebpackPlugin.options.minify.constructor === Object ? templateParams.htmlWebpackPlugin.options.minify : {}; + html = minify(html, minify_options); + } + compilation.assets[outputFilename] = { source: function() { return html;