html-webpack-plugin
html-webpack-plugin copied to clipboard
Boolean attributes can be made shorter
Hi there,
Current behaviour 💣
http-webpack-plugin generates:
<script defer="defer">
<script defer="defer" nomodule="">
Expected behaviour ☀️
defer is boolean attributes https://html.spec.whatwg.org/multipage/scripting.html#attr-script-defer .
<script defer>
<script defer nomodule>
I am not sure if it's on purpose. They are equivalent but it would be shorter and simpler.
Reproduction Example 👾
Environment 🖥
$ npm ls html-webpack-plugin
└── [email protected]
Doesn't the html-minifier minify that for production?
It does not. I opened #1705 .
I guess changing this default setting might break some production apps..
We tried to pick only the safe values: https://github.com/jantimon/html-webpack-plugin/pull/1048
but you can easily adjust the minification settings according to your requirements in the options
Yes, we can't enable it by default because of this http://perfectionkills.com/experimenting-with-html-minifier/#collapse_boolean_attributes, it can be unsafe, so please enable it on own side if it is safe for you, anyway thank you for the issue