html-webpack-plugin 5.0.0 → 5.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +7 -0
- package/README.md +1 -1
- package/lib/html-tags.js +5 -5
- package/package.json +1 -1
- package/typings.d.ts +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
## [5.1.0](https://github.com/jantimon/html-webpack-plugin/compare/v5.0.0...v5.1.0) (2021-02-12)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
* omit html tag attribute with null/undefined/false value ([aa6e78d](https://github.com/jantimon/html-webpack-plugin/commit/aa6e78d1430c17d9cf05550b2c9f73a9a0c0166c)), closes [#1598](https://github.com/jantimon/html-webpack-plugin/issues/1598)
|
|
11
|
+
|
|
5
12
|
## [5.0.0](https://github.com/jantimon/html-webpack-plugin/compare/v4.5.1...v5.0.0) (2021-02-03)
|
|
6
13
|
|
|
7
14
|
|
package/README.md
CHANGED
|
@@ -150,7 +150,7 @@ Allowed values are as follows:
|
|
|
150
150
|
|**`templateParameters`**|`{Boolean\|Object\|Function}`| `false`| Allows to overwrite the parameters used in the template - see [example](https://github.com/jantimon/html-webpack-plugin/tree/master/examples/template-parameters) |
|
|
151
151
|
|**`inject`**|`{Boolean\|String}`|`true`|`true \|\| 'head' \|\| 'body' \|\| false` Inject all assets into the given `template` or `templateContent`. When passing `'body'` all javascript resources will be placed at the bottom of the body element. `'head'` will place the scripts in the head element. Passing `true` will add it to the head/body depending on the `scriptLoading` option. Passing `false` will disable automatic injections. - see the [inject:false example](https://github.com/jantimon/html-webpack-plugin/tree/master/examples/custom-insertion-position)|
|
|
152
152
|
|**`publicPath`**|`{String\|'auto'}`|`'auto'`|The publicPath used for script and link tags|
|
|
153
|
-
|**`scriptLoading`**|`{'blocking'\|'defer'}`|`'
|
|
153
|
+
|**`scriptLoading`**|`{'blocking'\|'defer'}`|`'defer'`| Modern browsers support non blocking javascript loading (`'defer'`) to improve the page startup performance. |
|
|
154
154
|
|**`favicon`**|`{String}`|``|Adds the given favicon path to the output HTML|
|
|
155
155
|
|**`meta`**|`{Object}`|`{}`|Allows to inject `meta`-tags. E.g. `meta: {viewport: 'width=device-width, initial-scale=1, shrink-to-fit=no'}`|
|
|
156
156
|
|**`base`**|`{Object\|String\|false}`|`false`|Inject a [`base`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/base) tag. E.g. `base: "https://example.com/path/page.html`|
|
package/lib/html-tags.js
CHANGED
|
@@ -25,12 +25,12 @@ const voidTags = ['area', 'base', 'br', 'col', 'embed', 'hr', 'img', 'input', 'k
|
|
|
25
25
|
* A tag element according to the htmlWebpackPlugin object notation
|
|
26
26
|
*
|
|
27
27
|
* @param xhtml {boolean}
|
|
28
|
-
*
|
|
28
|
+
* Whether the generated html should add closing slashes to be xhtml compliant
|
|
29
29
|
*/
|
|
30
30
|
function htmlTagObjectToString (tagDefinition, xhtml) {
|
|
31
31
|
const attributes = Object.keys(tagDefinition.attributes || {})
|
|
32
32
|
.filter(function (attributeName) {
|
|
33
|
-
return tagDefinition.attributes[attributeName]
|
|
33
|
+
return tagDefinition.attributes[attributeName] === '' || tagDefinition.attributes[attributeName];
|
|
34
34
|
})
|
|
35
35
|
.map(function (attributeName) {
|
|
36
36
|
if (tagDefinition.attributes[attributeName] === true) {
|
|
@@ -49,13 +49,13 @@ function htmlTagObjectToString (tagDefinition, xhtml) {
|
|
|
49
49
|
* @param {string} tagName
|
|
50
50
|
* the name of the tag e.g. 'div'
|
|
51
51
|
*
|
|
52
|
-
* @param {{[attributeName: string]: string|boolean}} [attributes]
|
|
52
|
+
* @param {{[attributeName: string]: string|boolean|null|undefined}} [attributes]
|
|
53
53
|
* tag attributes e.g. `{ 'class': 'example', disabled: true }`
|
|
54
54
|
*
|
|
55
55
|
* @param {string} [innerHTML]
|
|
56
56
|
*
|
|
57
|
-
* @param {{[attributeName: string]: string|boolean}} [meta]
|
|
58
|
-
* meta information about the tag e.g. `{ '
|
|
57
|
+
* @param {{[attributeName: string]: string|boolean|null|undefined}} [meta]
|
|
58
|
+
* meta information about the tag e.g. `{ 'plugin': 'html-webpack-plugin' }`
|
|
59
59
|
*
|
|
60
60
|
* @returns {HtmlTagObject}
|
|
61
61
|
*/
|
package/package.json
CHANGED
package/typings.d.ts
CHANGED
|
@@ -263,7 +263,7 @@ declare namespace HtmlWebpackPlugin {
|
|
|
263
263
|
* E.g. `{'disabled': true, 'value': 'demo'}`
|
|
264
264
|
*/
|
|
265
265
|
attributes: {
|
|
266
|
-
[attributeName: string]: string | boolean;
|
|
266
|
+
[attributeName: string]: string | boolean | null | undefined;
|
|
267
267
|
};
|
|
268
268
|
/**
|
|
269
269
|
* The tag name e.g. `'div'`
|