Consider HTML Minifier Next for HTML minification?#1891
Open
j9t wants to merge 2 commits into
Open
Conversation
Signed-off-by: Jens Oliver Meiert <jens@meiert.com>
Signed-off-by: Jens Oliver Meiert <jens@meiert.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Started off as a test PR: The PR humbly proposes HTML Minifier Next (HMN) as a compatible, maintained, faster, and more secure alternative to HTML Minifier Terser (it’s the official successor to HTML Minifier).
I took care of some small fixes and improvements—quick summary:
defer(development mode, no minifier)—updated todefer="defer"after changing how the plugin sets the attributecollapseBooleanAttributes: true(maybe worth considering!)...new Set(...)spread because no target was set in tsconfig (defaulting to ES3)—added"target": "es2017"to match the existing lib settingdefer→defer=defer(valid but unquoted) when the minifier receives it, which differed from the old fixtures. To get the consistentdefer="defer"output, I changedattributes.defer = truetoattributes.defer = "defer"ingeneratedScriptTags. This is again to keep things as consistent with possible as with the previous setup.General note: As mentioned, HMN is fundamentally compatible, but a couple of major changes were introduced, and then it also has some convenience features (like presets) and some new flags that may be worth checking out. I only scanned the list of issues in this repo, but the fixes made in HMN might even help address some issues here.
Happy to help a bit more, but as I maintain HMN I also don’t want to impose—I rather propose this for you to make a call if this is a useful update for HTML Webpack Plugin or not. Cheers!