htmlnano

Modular HTML minifier, built on top of the PostHTML. Inspired by cssnano.
Benchmarks
Latest benchmarks: https://github.com/maltsev/html-minifiers-benchmark (updated daily).
Documentation
https://htmlnano.netlify.app
Usage
npm install htmlnano
const htmlnano = require('htmlnano');
const options = {
removeEmptyAttributes: false,
collapseWhitespace: 'conservative'
};
const postHtmlOptions = {
sync: true,
lowerCaseTags: true,
quoteAllAttributes: false,
};
htmlnano
.process(html, options, preset, postHtmlOptions)
.then(function (result) {
})
.catch(function (err) {
console.error(err);
});
More usage examples (PostHTML, Gulp, Webpack): https://htmlnano.netlify.app/next/usage