diff --git a/docs/modules/html-minifier.md b/docs/modules/html-minifier.md new file mode 100644 index 00000000..4ae28536 --- /dev/null +++ b/docs/modules/html-minifier.md @@ -0,0 +1,19 @@ +--- +description: Modern replacement for the html-minifier package for minifying HTML with embedded CSS, JavaScript, and SVG +--- + +# Replacements for `html-minifier` + +## `html-minifier-next` + +[`html-minifier-next`](https://github.com/j9t/html-minifier-next) is the official successor to [`html-minifier`](https://github.com/kangax/html-minifier). It is actively maintained, faster, and adds features such as SVG minification and preset configurations. + +```ts +import minify from 'html-minifier' // [!code --] +import { minify } from 'html-minifier-next' // [!code ++] + +const html = '
foo
' + +const result = minify(html, { collapseWhitespace: true }) // [!code --] +const result = await minify(html, { collapseWhitespace: true }) // [!code ++] +``` diff --git a/manifests/preferred.json b/manifests/preferred.json index ce08a000..591a4764 100644 --- a/manifests/preferred.json +++ b/manifests/preferred.json @@ -468,6 +468,12 @@ "replacements": ["zlib.gzipSync"], "url": {"type": "e18e", "id": "gzip-size"} }, + "html-minifier": { + "type": "module", + "moduleName": "html-minifier", + "replacements": ["html-minifier-next"], + "url": {"type": "e18e", "id": "html-minifier"} + }, "inherits": { "type": "module", "moduleName": "inherits", @@ -3113,6 +3119,11 @@ }, "h3": {"id": "h3", "type": "documented", "replacementModule": "h3"}, "hono": {"id": "hono", "type": "documented", "replacementModule": "hono"}, + "html-minifier-next": { + "id": "html-minifier-next", + "type": "documented", + "replacementModule": "html-minifier-next" + }, "import.meta.resolve": { "id": "import.meta.resolve", "type": "native",