npm / html-minifier-next
html-minifier-next
What changed in html-minifier-next 8 to 9, from its official release notes, upgrade guides and advisories. Sources checked 2026-10-24.
4 breaking2 new APIs and options5 performance1 behavior and defaults3 fixes and other
See which of these apply to your code, ranked, in your agent:
npx @unstale/cli inithtml-minifier-next 98 changes
Breaking changes 2
JSON minification now only removes whitespace between tokens and shortens string escapes, preserving large and out-of-range numbers, negative zero, and duplicate keys.
JSON is no longer minified by default or by the conservative preset; enable minifyJSON or use the comprehensive preset.
New APIs and options 1
Adds an option to minify JSON script types, including application/ld+json, importmap, and speculationrules; it is included by the comprehensive preset.
Performance 5
When engine is swc, minifyJS now also uses SWC to minify event handler attributes instead of always using Terser, improving performance.
Improved removeUnusedCSS performance.
Improved sortAttributes performance.
Improved sortClassNames performance.
Improves the performance of collapseAttributeWhitespace.
html-minifier-next 87 changes
Breaking changes 2
CRLF and CR line breaks are written as line feeds, except in markup within htmlmin:ignore and custom fragments with whitespace padding them.
Removes namespace declarations HTML reads anyway, including on inline SVG and html; this also applies after SVGO under minifySVG.
New APIs and options 1
Writes empty SVG and MathML elements as self-closing; the comprehensive preset includes this option.
Behavior and default changes 1
Handles several additional default values.
Fixes and other changes 3
Carriage return references are decoded without introducing raw carriage returns that HTML reads as line feeds, preserving text in pre elements and attribute values.
SVG using xlink: attributes without an XLink namespace declaration is no longer left unminified or made to fail when continueOnMinifyError is false.
Handles SVG default values while preserving presentation attributes that inherit and gradients, patterns, and filters that refer to another.