Tinyhtml is a compact, reliable, and customizable HTML minifier for Node.js. The current stable version is 0.0.72, released on npm. It focuses on removing unnecessary whitespace, collapsing attribute values, and optionally parsing script/style tags with custom parsers. Unlike other minifiers, it provides fine-grained control over tag content via parsers and allows preserving specific whitespace patterns. It is actively maintained, with a simple API and no dependencies. Suitable for build pipelines and server-side HTML compression.
npm install tinyhtmlNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Minifies an HTML string by removing unnecessary whitespace, collapsing attribute values, and stripping optional quotes.
Use dynamic import() or upgrade to ES modules.
Replace 'comments: true' with a custom parser for comments.
Use the 'parsers' option to preserve whitespace in script/style tags.
Use custom parsers if you need to preserve attribute values.
Use dynamic import() or convert your project to ES modules.
Run 'npm install tinyhtml@latest --save' or 'npm install tinyhtml@latest --save-dev' if only needed in dev.
Use "tinyHTML = require('tinyhtml').default || require('tinyhtml')" or switch to import.No dependency data recorded yet.