From 4b90b9b4ca7f7b6f1cdec567f8be5880b06406bd Mon Sep 17 00:00:00 2001 From: Paul Valladares <85648028+dreyfus92@users.noreply.github.com> Date: Thu, 11 Jun 2026 19:36:07 -0600 Subject: [PATCH 1/2] feat: add html-minifier to replacements --- docs/modules/html-minifier.md | 33 +++++++++++++++++++++++++++++++++ manifests/preferred.json | 11 +++++++++++ 2 files changed, 44 insertions(+) create mode 100644 docs/modules/html-minifier.md diff --git a/docs/modules/html-minifier.md b/docs/modules/html-minifier.md new file mode 100644 index 00000000..08a13a39 --- /dev/null +++ b/docs/modules/html-minifier.md @@ -0,0 +1,33 @@ +--- +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 ++] +``` + +CommonJS: + +```ts +const minify = require('html-minifier').minify // [!code --] +const { minify } = require('html-minifier-next') // [!code ++] + +const html = '

foo

' + +;(async () => { + 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", From 8c06148af437e3d514c2132e7cc09151e355c069 Mon Sep 17 00:00:00 2001 From: James Garbutt <43081j@users.noreply.github.com> Date: Sun, 14 Jun 2026 09:10:42 +0100 Subject: [PATCH 2/2] Apply suggestion from @43081j --- docs/modules/html-minifier.md | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/docs/modules/html-minifier.md b/docs/modules/html-minifier.md index 08a13a39..4ae28536 100644 --- a/docs/modules/html-minifier.md +++ b/docs/modules/html-minifier.md @@ -17,17 +17,3 @@ const html = '

foo

' const result = minify(html, { collapseWhitespace: true }) // [!code --] const result = await minify(html, { collapseWhitespace: true }) // [!code ++] ``` - -CommonJS: - -```ts -const minify = require('html-minifier').minify // [!code --] -const { minify } = require('html-minifier-next') // [!code ++] - -const html = '

foo

' - -;(async () => { - const result = minify(html, { collapseWhitespace: true }) // [!code --] - const result = await minify(html, { collapseWhitespace: true }) // [!code ++] -})() -```