1998-12-31T23:00:00.000Z
})
diff --git a/README.md b/README.md index 9a518907..56150055 100644 --- a/README.md +++ b/README.md @@ -116,7 +116,7 @@ Allowed values are as follows |**[`inject`](#)**|`{Boolean\|String}`|`true`|`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`](#)**|`{String}`|``|Adds the given favicon path to the output HTML| |**[`meta`](#)**|`{Object}`|`{}`|Allows to inject `meta`-tags. E.g. `meta: {viewport: 'width=device-width, initial-scale=1, shrink-to-fit=no'}`| -|**[`minify`](#)**|`{Boolean\|Object}`|`false`|Pass [html-minifier](https://github.com/kangax/html-minifier#options-quick-reference)'s options as object to minify the output| +|**[`minify`](#)**|`{Boolean\|Object}`|`true` if `mode` is `'production'`, otherwise `false`|Controls if and in what ways the output should be minified. See [minification](#minification) below for more details.| |**[`hash`](#)**|`{Boolean}`|`false`|If `true` then append a unique `webpack` compilation hash to all included scripts and CSS files. This is useful for cache busting| |**[`cache`](#)**|`{Boolean}`|`true`|Emit the file only if it was changed| |**[`showErrors`](#)**|`{Boolean}`|`true`|Errors details will be written into the HTML page| @@ -285,6 +285,26 @@ plugins: [ ] ``` +### Minification + +If the `minify` option is set to `true` (the default when webpack's `mode` is `'production'`), +the generated HTML will be minified using [html-minifier](https://github.com/kangax/html-minifier) +and the following options: + +```js +{ + collapseWhitespace: true, + removeComments: true, + removeRedundantAttributes: true, + removeScriptTypeAttributes: true, + removeStyleLinkTypeAttributes: true, + useShortDoctype: true +} +``` + +To use custom [html-minifier options](https://github.com/kangax/html-minifier#options-quick-reference) +pass an object to `minify` instead. This object will not be merged with the defaults above. + ### `Events` To allow other [plugins](https://github.com/webpack/docs/wiki/plugins) to alter the HTML this plugin executes diff --git a/examples/appcache/dist/webpack-4/manifest.appcache b/examples/appcache/dist/webpack-4/manifest.appcache index 49b02bec..0f3a560d 100644 --- a/examples/appcache/dist/webpack-4/manifest.appcache +++ b/examples/appcache/dist/webpack-4/manifest.appcache @@ -1,5 +1,5 @@ CACHE MANIFEST -# a351a7eb0665a7fa27b3 +# 83ab7029cec7797a5a8a 0714810ae3fb211173e2964249507195.png bundle.js diff --git a/examples/chunk-optimization/dist/webpack-4/entryA.html b/examples/chunk-optimization/dist/webpack-4/entryA.html index 0125c79b..00ab2b9e 100644 --- a/examples/chunk-optimization/dist/webpack-4/entryA.html +++ b/examples/chunk-optimization/dist/webpack-4/entryA.html @@ -1,9 +1 @@ - - -
- -
-
-
+
\ No newline at end of file
diff --git a/examples/default/dist/webpack-4/index.html b/examples/default/dist/webpack-4/index.html
index 1d0b7be7..b0855186 100644
--- a/examples/default/dist/webpack-4/index.html
+++ b/examples/default/dist/webpack-4/index.html
@@ -1,9 +1 @@
-
-
-
-
-
-
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/examples/html-loader/dist/webpack-4/index.html b/examples/html-loader/dist/webpack-4/index.html
index 5689f881..166bf3ed 100644
--- a/examples/html-loader/dist/webpack-4/index.html
+++ b/examples/html-loader/dist/webpack-4/index.html
@@ -1,11 +1 @@
-
-
-
-
-
-
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/examples/inline/dist/webpack-4/index.html b/examples/inline/dist/webpack-4/index.html
index 99d2004e..0ec0b1ff 100644
--- a/examples/inline/dist/webpack-4/index.html
+++ b/examples/inline/dist/webpack-4/index.html
@@ -1,4 +1,4 @@
-
\ No newline at end of file
diff --git a/examples/javascript/dist/webpack-4/index.html b/examples/javascript/dist/webpack-4/index.html
index fc2dba55..daac7ae4 100644
--- a/examples/javascript/dist/webpack-4/index.html
+++ b/examples/javascript/dist/webpack-4/index.html
@@ -1,2 +1 @@
-Hello World from backend2018-07-10T06:35:32.858Z
\ No newline at end of file
+Hello World from backend2018-09-15T20:52:24.239Z
\ No newline at end of file
diff --git a/examples/pug-loader/dist/webpack-4/index.html b/examples/pug-loader/dist/webpack-4/index.html
index 7deb41f2..8568a711 100644
--- a/examples/pug-loader/dist/webpack-4/index.html
+++ b/examples/pug-loader/dist/webpack-4/index.html
@@ -1 +1 @@
-1998-12-31T23:00:00.000Z
})
1999-01-01T00:00:00.000Z
})
-
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/examples/sort-manually/dist/webpack-4/second-file.html b/examples/sort-manually/dist/webpack-4/second-file.html
index 1ef7520f..ba8f8673 100644
--- a/examples/sort-manually/dist/webpack-4/second-file.html
+++ b/examples/sort-manually/dist/webpack-4/second-file.html
@@ -1,11 +1 @@
-
-
-
-
-
-
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/examples/template-parameters/dist/webpack-4/index.html b/examples/template-parameters/dist/webpack-4/index.html
index ccf2967a..2ac7ecd2 100644
--- a/examples/template-parameters/dist/webpack-4/index.html
+++ b/examples/template-parameters/dist/webpack-4/index.html
@@ -1,9 +1 @@
-
-
-
-
-