Skip to content

Conversation

@renovate
Copy link
Contributor

@renovate renovate bot commented Feb 5, 2026

This PR contains the following updates:

Package Change Age Confidence
html-minifier-next (source) ^4.17.0^5.0.0 age confidence

Release Notes

j9t/html-minifier-next (html-minifier-next)

v5.0.3

Compare Source

Fixed
  • Fixed empty elements with id attributes being incorrectly removed when removeEmptyElements was enabled (elements with IDs must be preserved as they serve as navigation targets, JavaScript selectors, and accessibility landmarks)
  • Fixed duplicate attributes being preserved in output (per HTML spec, when an attribute appears multiple times, only the first occurrence is kept; duplicates are now removed during minification)

v5.0.2

Compare Source

Fixed
  • Fixed SVG and MathML elements being incorrectly removed when removeEmptyElements was enabled (foreign content is now excluded from empty element removal; HTML content inside <foreignObject> and <annotation-xml> is correctly processed as HTML)
  • Fixed parseRegExp not extracting flags from regex strings (e.g., /pattern/gi now correctly creates a case-insensitive global regex)
Internal
  • Deduplicated option definitions and parseRegExp between CLI, library, and web demo into shared modules (src/lib/option-definitions.js, src/lib/utils.js)

v5.0.1

Compare Source

Fixed
  • Fixed <tbody> (and other table section) start tags being incorrectly stripped when removeOptionalTags and includeAutoGeneratedTags: false (new default) were both active

v5.0.0

Compare Source

Added
  • Added CLI shortcut flags for directory and preset options: -I (--input-dir), -O (--output-dir), -X (--ignore-dir), -f (--file-ext), -p (--preset)
  • Added customAttrAssign, customAttrCollapse, ignoreCustomComments, and inlineCustomElements options to the web demo
Changed

[The following reads more complicated than it is. Consider going through the brief upgrade guide.]

  • BREAKING: Directory mode (--input-dir) now defaults to processing only .html, .htm, .xhtml, and .shtml files instead of all files
    • To process all files, use --file-ext='*'; to process specific extensions, use --file-ext=html,php,twig (replaces defaults)
    • Migration: If you relied on the previous “all files” default, set fileExt in your config or specify extensions for --file-ext
  • BREAKING: includeAutoGeneratedTags now defaults to false, that is, the minifier no longer inserts closing tags that weren’t in the source (e.g., auto-generated </p>, </option>)
    • Migration: If you need the old normalizing behavior, set includeAutoGeneratedTags: true in your config or pass --include-auto-generated-tags
  • BREAKING: Removed the html5 option; “HTML5” parsing is now always active, and the legacy HTML 4 inline/block nesting mode no longer available
    • Migration: Remove html5: true from your config (it’s now the only behavior); if you relied on html5: false, review your output for changes in element nesting
  • BREAKING: sortClassName was renamed to sortClassNames
    • Migration: If using sortClassName, rename to sortClassNames
  • BREAKING: Revised conservative and comprehensive presets
    • conservative: Added caseSensitive, processConditionalComments; removed continueOnParseError, decodeEntities, minifyURLs, noNewlinesBeforeTagClose
    • comprehensive: Added collapseAttributeWhitespace; removed caseSensitive, noNewlinesBeforeTagClose, sortAttributes, sortClassNames
    • Migration: If you rely on specific preset behavior, override individual options as needed (e.g., { preset: 'conservative', decodeEntities: true })
  • BREAKING: Replaced relateurl dependency with a built-in URL minifier using Node’s WHATWG URL API
    • The minifyURLs option still accepts true, a string (site URL), { site: '…' }, or a custom function
    • relateurl-specific options (e.g., removeAuth, removeEmptyQueries, ignore_www, schemeRelative) are no longer supported
    • Migration: If you passed relateurl-specific options via minifyURLs: { site: '…', removeAuth: true, … }, remove unsupported properties; only site is accepted
  • Replaced change-case dependency with inline case conversion for CLI option names
Performance
  • Replaced string slicing with sticky (y flag) regex matching in the HTML parser, reducing memory allocations on large inputs
  • Added next-tag lookahead caching to avoid re-parsing the same tag twice during whitespace context detection
Internal
  • Checked on and removed unused dependencies

v4.19.1

Compare Source

Changed
  • Removed CI=true environment variable detection for cache size defaults; use cacheCSS/cacheJS options or HMN_CACHE_CSS/HMN_CACHE_JS environment variables instead
  • Documented SVG leading and trailing zero removal
Fixed
  • Updated CommonJS preset example to use { preset: 'comprehensive' } instead of getPreset()

v4.19.0

Compare Source

Added
  • Introduced configurable minification cache sizes for CSS and JavaScript
    • New cacheCSS and cacheJS options in config file and programmatic API, --cache-css and --cache-js CLI flags
    • Environment variable support: HMN_CACHE_CSS and HMN_CACHE_JS
    • Default: 500 entries (CSS/JS)
Changed
  • Refactored HTML parser to reduce string slicing operations, improving memory efficiency for large files
  • Made HTML parser correctly handle quoted attributes exceeding 20 KB (e.g., large data URIs, inline assets) by searching the full document for attribute boundaries instead of the limited substring
  • Simplified URL cache initialization by importing LRU directly in options module

v4.18.0

Compare Source

Added
  • New mergeScripts option to merge consecutive inline <script> elements into one (saves </script><script> overhead)
    • Only merges compatible scripts (same type, matching async/defer/nomodule/nonce attributes)
    • Does not merge external scripts (with src attribute)
Changed
  • SVG path optimization now removes leading zeros before decimal points (e.g., 0.5.5, -0.25-.25)
  • Empty crossorigin and contenteditable attributes now collapse to just the attribute name (e.g., crossorigin=""crossorigin)
  • Pre-compiled regex patterns for tag removal functions to avoid repeated allocation

v4.17.2

Compare Source

Changed
  • collapseWhitespace now trims single trailing newlines inside <pre> and <textarea> elements
    • Removes unintentional newlines often added by template engines before closing tags (e.g., </code></pre>)
    • Multiple consecutive newlines are preserved (likely intentional formatting)
    • Leading newlines and internal whitespace remain unchanged

v4.17.1

Compare Source

Changed
  • Removed aggressive collapseInlineTagWhitespace setting from comprehensive preset
Fixed
  • Fixed preset option in programmatic API
    • Previously, users had to manually spread preset values using getPreset(): minify(html, { ...getPreset('comprehensive') })
    • Now the simpler syntax works as documented: minify(html, { preset: 'comprehensive' })

Configuration

📅 Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.

Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 Ignore: Close this PR and you won't be reminded about this update again.


  • If you want to rebase/retry this PR, check this box

This PR was generated by Mend Renovate. View the repository job log.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants