From d1b173f9442d01d814590f991ddcece81c8f0274 Mon Sep 17 00:00:00 2001 From: Zach Green Date: Thu, 2 Jan 2020 15:59:53 +0100 Subject: [PATCH 1/3] docs: fix link to compilation object --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index bf450663..566d150e 100644 --- a/README.md +++ b/README.md @@ -281,7 +281,7 @@ The following variables are available in the template: - `webpackConfig`: the webpack configuration that was used for this compilation. This can be used, for example, to get the `publicPath` (`webpackConfig.output.publicPath`). -- `compilation`: the webpack [compilation](https://webpack.js.org/api/compilation/) object. +- `compilation`: the webpack [compilation object](https://webpack.js.org/api/compilation-object/). This can be used, for example, to get the contents of processed assets and inline them directly in the page, through `compilation.assets[...].source()` (see [the inline template example](examples/inline/template.pug)). From 2281e4bfda9b91c4a83d63bfc8df8372d1e6ae9e Mon Sep 17 00:00:00 2001 From: Jan Nicklas Date: Thu, 26 Mar 2020 11:07:17 +0100 Subject: [PATCH 2/3] fix: don't remove trailing slashes from self closing tags by default --- index.js | 5 +++-- spec/basic.spec.js | 23 +++++++++++++++++++++++ 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/index.js b/index.js index e6779f5f..764e0fc6 100644 --- a/index.js +++ b/index.js @@ -115,10 +115,11 @@ class HtmlWebpackPlugin { const minify = this.options.minify; if (minify === true || (minify === 'auto' && isProductionLikeMode)) { - /** @type { import('html-minifier').Options } */ + /** @type { import('html-minifier-terser').Options } */ this.options.minify = { - // https://github.com/kangax/html-minifier#options-quick-reference + // https://www.npmjs.com/package/html-minifier-terser#options-quick-reference collapseWhitespace: true, + keepClosingSlash: true, removeComments: true, removeRedundantAttributes: true, removeScriptTypeAttributes: true, diff --git a/spec/basic.spec.js b/spec/basic.spec.js index 5d706c47..5e95725a 100644 --- a/spec/basic.spec.js +++ b/spec/basic.spec.js @@ -2304,4 +2304,27 @@ describe('HtmlWebpackPlugin', () => { ] }, [/