kangax / kangax/html-minifier

Support for ES6 minification

Open
#1,040 19 comments 12 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
5k
Forks
577
PR merge metrics
No merged PRs in 30d

Description

Hi

the `html-webpack-plugin` is making heavy use of `html-minifier` to keep the html compact.

Now that many browsers support ES6 out of the box, people start using ES6 inside script tags.
According to @evilebottnawi from the `webpack` team using ES6 is not possible because `html-minifier` is not capable of parsing ES6: https://github.com/jantimon/html-webpack-plugin/issues/1262

When `webpack` was faced with the same problem they made a switch to `terser` which has now about 6 million downloads per week.

> uglify-es is no longer maintained and uglify-js does not support ES6+.
>
> terser is a fork of uglify-es that mostly retains API and CLI compatibility with uglify-es and uglify-js@3.
>
(taken from their [official readme](https://www.npmjs.com/package/terser))

There was already a proposal to do the same change for the `html-minifier`: #1034

It would mean to replace https://github.com/kangax/html-minifier/blob/51ce10f4daedb1de483ffbcccecc41be1c873da2/package.json#L63 with `terser`

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by inspecting the dependency entry in package.json referenced by the issue and read proposal #1034 for context on the html-minifier change. Replace the referenced minifier dependency with terser and verify that ES6 inside script tags is handled without breaking the existing HTML minification behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, node.js
Domain
tooling
Issue type
Feature
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
40/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.