Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions docs/modules/html-minifier.md
Original file line number Diff line number Diff line change
@@ -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 = '<p title="example">foo</p>'

const result = minify(html, { collapseWhitespace: true }) // [!code --]
const result = await minify(html, { collapseWhitespace: true }) // [!code ++]
```
11 changes: 11 additions & 0 deletions manifests/preferred.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down