Introducing The Sweep: OX’s New Live Security Research Series
Register Now
Breaking: The 2026 Vulnpocalypse Hits PHP: Four Critical RCEs, but How Dangerous Are They?
Read the Report
Are you exposed? Connect your apps in minutes.
Scan your apps free

html-minifier-next

Latest version: v9.1.3

Overview

Last scanned
2 Dec 2026
Published
2 Dec 2026
npm package Publisher: j9t
174 Stars
9 Forks
38 Versions
435.0K Downloads
JavaScript Repo language

Scan summary

html-minifier-next was last scanned on 2 Dec 2026 at version 9.1.3. Risk score 0 of 100. No malicious behavior was detected.

  • Releases: 38 versions; the latest was published on 2 Dec 2026.
  • Findings: No rules fired in version 9.1.3.
  • Downloads: 435,027 downloads.

Versions

38 versions published
Versions and the rules that fired in each
VersionPublishedStatus
9.1.3 LATEST 2 Dec 2026 No rules fired
9.1.2 3 Nov 2026 No rules fired
9.1.1 28 Oct 2026 No rules fired
9.1.0 25 Oct 2026 Not shown
9.0.1 20 Oct 2026 Not shown

No rules fired in 9.1.3

Findings

Findings for v9.1.3. The score is a capped sum of the weights of the rules that fired — not CVSS, not exploitability, and not a probability. It is not comparable across packages with different scan coverage.

The score describes 9.1.3; other versions have their own rules, not their own score.

Known vulnerabilities

1 CVE · last 30 Nov 2026

0 CRITICAL 1 HIGH 0 MEDIUM 0 LOW

Versions

  • ≥ 9.1.2
  • < 9.1.2 1 HIGH

Vulnerabilities

  • CVE-2026-140010 High 30 Nov 2026 HTML Minifier Next: Regular expressions in `minify()` cause O(n²) backtracking on ignored and custom-fragment content Fixed in 9.1.2

README

The publisher’s own README, as collected from the registry.

HTML Minifier Next

npm version Test status

Your web page optimization precision tool: HTML Minifier Next (HMN) is a highly effective, super-configurable, well-tested HTML minifier, written in JavaScript, that also handles in-document CSS, JavaScript, and SVG minification.

The project was based on HTML Minifier Terser (HMT), which in turn had been based on Juriy “kangax” Zaytsev’s HTML Minifier (HM). HMN is the official successor to HTML Minifier: It’s actively maintained, richer in features, easier to use, and significantly faster (HMN engineering philosophy). Note that HMN is largely compatible with HM and HMT but isn’t fully drop-in—find migration guidance in the changelog.

⚠️ HTML Minifier Next is becoming HTML Minifier! Use the HTML Minifier Next to HTML Minifier migration guide to switch. (HTML Minifier Next will eventually be deprecated.)

Installation

HTML Minifier Next is ESM-only and requires Node.js ≥22.13.

For use as a command-line app, use npx:

npx html-minifier-next --help

(For immediate, zero-config use in the current folder: npx html-minifier-next --zero)

For programmatic use, install as a development dependency:

npm i -D html-minifier-next

General Usage

CLI

Use npx html-minifier-next --help to check all available options:

Option Description Example
--zero, -z Minify all HTML files in the current folder and its subfolders in place (except node_modules), using comprehensive settings (standalone—the flag is ignored when combined with other options) npx html-minifier-next --zero
--input-dir <dir>, -I <dir> Specify an input directory --input-dir=src
--ignore-dir <patterns>, -X <patterns> Exclude directories—relative to input directory—from processing (comma-separated, overrides config file setting) --ignore-dir=libs, --ignore-dir=libs,vendor,node_modules
--output-dir <dir>, -O <dir> Specify an output directory --output-dir=dist
--workers <n>, -w <n> Number of worker threads for multi-file runs; defaults to half the available cores (at most 6) for runs large enough to justify them --workers=4
--input <file>, -i <file> Specify input file (alternative to positional argument; pair with --output for file output) npx html-minifier-next -i input.html -o output.html
--output <file>, -o <file> Specify output file (reads from --input file argument or STDIN; outputs to STDOUT if not specified) File to file: npx html-minifier-next input.html -o output.htmlFile to file (explicit): npx html-minifier-next -i input.html -o output.htmlPipe to file: cat input.html \| npx html-minifier-next -o output.htmlFile to STDOUT: npx html-minifier-next input.html
--file-ext <extensions>, -f <extensions> Specify file extension(s) to process (comma-separated, overrides config file setting); defaults to html,htm,shtml,shtm; use * for all files --file-ext=html,php, --file-ext='*'
--preset <name>, -p <name> Use a preset configuration (conservative or comprehensive) --preset=conservative
--config-file <file>, -c <file> Use a configuration file (defaults to html-minifier-next.config.json in the working directory, if present) --config-file=path/to/config.json
--verbose, -v Show detailed processing information (active options, worker thread count, file statistics, and minifier warnings) npx html-minifier-next --input-dir=src --output-dir=dist --verbose --collapse-whitespace
--dry, -d Dry run: Process and report statistics without writing output npx html-minifier-next input.html --dry --collapse-whitespace
Configuration File

You can use a configuration file to specify options. If an html-minifier-next.config.json file is present in the current working directory—only there; subfolders (including --input-dir) and parent folders are not searched—the CLI picks it up automatically, with a note on STDERR confirming this. An explicit --config-file takes precedence. (The standalone --zero mode is deliberately config-free and ignores default config files.) The file can be either in JSON format or a JavaScript module that exports the configuration object:

JSON configuration example:

{
  "collapseWhitespace": true,
  "removeComments": true,
  "fileExt": "html,php",
  "ignoreDir": "libs,vendor"
}

For editor support (validation, autocomplete, and inline documentation) in JSON configuration files, reference the JSON Schema that ships with the package:

{
  "$schema": "https://raw.githubusercontent.com/j9t/html-minifier-next/main/html-minifier-next.schema.json",
  "collapseWhitespace": true,
  "removeComments": true
}

(If HMN is installed locally, you can also use the path ./node_modules/html-minifier-next/html-minifier-next.schema.json instead of the URL.)

JavaScript module configuration example (requires "type": "module" in the project’s package.json, or use a .mjs extension):

export default {
  collapseWhitespace: true,
  removeComments: true,
  fileExt: "html,php",
  ignoreDir: ["libs", "vendor"]
};

A module can also hold values JSON cannot express, like regular expressions (e.g., ignoreCustomFragments: [/\{\{[\s\S]*?\}\}/]) and functions (for minifyCSS, minifyJS, and minifyURLs, or in custom SVGO plugins for minifySVG). As functions cannot be passed to worker threads, a run using them minifies in-process.

Node.js
import { minify } from 'html-minifier-next';

const result = await minify('<p title="example" id="moo">foo</p>', {
  removeAttributeQuotes: true,
  removeOptionalTags: true
});
console.log(result); // `<p title=example id=moo>foo`

(CommonJS consumers can still use dynamic import—const { minify } = await import('html-minifier-next')—as minify() is async.)

See the original blog post for details of how it works, descriptions of most options, testing results, and conclusions.

Presets

HTML Minifier Next provides presets for common use cases. Presets are pre-configured option sets that can be used as a starting point:

  • conservative: Basic minification with whitespace collapsing, comment removal, and removal of select attributes.
  • comprehensive: More advanced minification for better file size reduction, including relevant conservative options plus attribute quote removal, optional tag removal, and more.

To review the specific options set, presets.js lists them in an accessible manner. For output served with Gzip or Brotli, see “Optimizing for Compression” for what to add.

Using presets:

# Via CLI flag
npx html-minifier-next --preset conservative input.html

# Via config file
npx html-minifier-next --config-file=path/to/config.json input.html
# where config.json contains `{ "preset": "conservative" }`

# Override preset options
npx html-minifier-next --preset conservative --remove-empty-attributes input.html

Priority order: Presets are applied first, then config file options, then CLI flags. This allows you to start with a preset and customize as needed.

Options Quick Reference

Most of the options are disabled by default. Experiment and find what works best for you and your project.

Options can be used in config files (camelCase) or via CLI flags (kebab-case with -- prefix). Boolean options generally support both --option-name to enable and --no-option-name to disable, so you can override a preset or config file from the command line. (Exception: Options whose name already starts with no-, such as noNewlinesBeforeTagClose, only expose the --no-… CLI flag.)

OX Radar and Response Center

Find threats in your stack.

OX Radar can check high-priority threats, like critical package CVEs, against your context.

Each incident is marked Detected or Not Detected with a remediation plan and proof all tracked in the Response Center.

Where it’s listed

The probe returned only these fields for this server — auth requirement, protocol and tool list weren’t observed, so they’re not shown (never guessed).

  • npm html-minifier-next

References

The publisher’s own links, as the registry reports them. These are not sources for the assessment on this page.

Powered by Read the latest findings

Scan your whole stack

Group 1261154050 1
Group 1261154050
 

From OX Research Newsroom

Copy of Template Design OX Blog (2)
Research

NGINX2Root: Five Critical NGINX Flaws Expose Web Servers to Remote Code Execution

The 2026 Vulnpocalypse Hits PHP: Four Critical RCEs, but How Dangerous Are They?
Vulnerability Insights

The 2026 Vulnpocalypse Hits PHP: Four Critical RCEs, but How Dangerous Are They?

Microsoft's Official agent framework Hijacked
AI & VibeSec

BREAKING: Hijacked Releases of Microsoft’s Official agent-framework Steals Azure and CI Credentials

Frame 2085668439 (1)
Group 1261154229