SkillAgentSearch skills...

Htmlnano

Modular HTML minifier, built on top of the PostHTML

Install / Use

/learn @maltsev/Htmlnano
About this skill

Quality Score

0/100

Supported Platforms

Universal

README

<h1><img src="docs/static/logo.png" alt="htmlnano logo" width="90" align="absmiddle">&nbsp;htmlnano</h1>

npm version CI

Modular HTML minifier, built on top of the PostHTML. Inspired by cssnano.

Documentation

https://htmlnano.netlify.app

Usage

npm install htmlnano
const htmlnano = require('htmlnano');
const options = {
    removeEmptyAttributes: false, // Disable the module "removeEmptyAttributes"
    collapseWhitespace: 'conservative' // Pass options to the module "collapseWhitespace"
};
// posthtml, posthtml-render, and posthtml-parse options
const postHtmlOptions = {
    sync: true, // https://github.com/posthtml/posthtml#usage
    lowerCaseTags: true, // https://github.com/posthtml/posthtml-parser#options
    quoteAllAttributes: false, // https://github.com/posthtml/posthtml-render#options
};

htmlnano
    // "preset" arg might be skipped (see "Presets" section below for more info)
    // "postHtmlOptions" arg might be skipped
    .process(html, options, preset, postHtmlOptions)
    .then(function (result) {
        // result.html is minified
    })
    .catch(function (err) {
        console.error(err);
    });

Also, you can use it as CLI tool:

node_modules/.bin/htmlnano --help

More usage examples (PostHTML, CLI, Webpack): https://htmlnano.netlify.app/usage

Benchmarks

| Website | Source (KB) | html-minifier-terser | html-minifier-next | htmlnano | minify | minify-html | | --------------------------------------------------------------- | ----------: | ---------------------: | -------------------: | ---------: | --------: | ------------: | | alistapart.com | 63 | 7.6% | 11.6% | 34.6% | 11.1% | 8.6% | | developer.mozilla.org | 109 | 38.0% | 41.7% | 52.8% | 40.1% | 39.9% | | css-tricks.com | 11 | 8.2% | 34.1% | 37.2% | 18.8% | 8.5% | | en.wikipedia.org | 224 | 4.5% | 7.4% | 7.2% | 60.6% | 2.9% | | github.com | 546 | 3.0% | 9.7% | 16.7% | 7.3% | 5.7% | | edri.org | 80 | 7.7% | 12.3% | 30.6% | 12.3% | 8.2% | | leanpub.com | 251 | 1.3% | 6.9% | 6.3% | 6.0% | 1.7% | | stackoverflow.blog | 139 | 3.9% | 5.7% | 7.0% | 4.6% | 4.7% | | html.spec.whatwg.org | 149 | -3.9% | 0.7% | -2.6% | 0.3% | 0.2% | | eff.org | 54 | 8.8% | 14.7% | 10.9% | 13.4% | 9.7% | | apple.com | 229 | 8.9% | 12.5% | 11.5% | 10.4% | 9.5% | | w3.org | 50 | 19.0% | 24.6% | 23.4% | 24.4% | 20.3% | | mastodon.social | 37 | 3.4% | 6.8% | 14.6% | 5.9% | 3.6% | | bbc.co.uk | 694 | 0.8% | 6.3% | 5.9% | 4.7% | 1.2% | | un.org | 151 | 14.2% | 22.5% | 41.2% | 20.0% | 15.0% | | lafrenchtech.gouv.fr | 152 | 13.2% | 17.9% | 64.1% | 17.0% | 13.8% | | sitepoint.com | 497 | 0.8% | 7.4% | 12.9% | 6.1% | 0.9% | | faz.net | 1572 | 3.4% | 8.0% | 15.8% | 4.8% | 3.6% | | weather.com | 2395 | 0.3% | 11.4% | 18.1% | 11.0% | 0.6% | | tc39.es | 7254 | 8.5% | 11.3% | 9.3% | 9.5% | 9.1% | | home.cern | 151 | 37.1% | 46.4% | 40.2% | 38.9% | 39.5% | | Avg. minify rate | | 9.0% | 15.2% | 21.8% | 15.6% | 9.9% |

Latest benchmarks: https://github.com/maltsev/html-minifiers-benchmark (updated daily).

View on GitHub
GitHub Stars296
CategoryDevelopment
Updated4d ago
Forks35

Languages

TypeScript

Security Score

95/100

Audited on Mar 30, 2026

No findings