Add support for minification using html-minifier
This commit is contained in:
parent
26b9f28937
commit
8b97335192
7
index.js
7
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;
|
||||
|
|
|
|||
Loading…
Reference in New Issue