Highly configurable, well-tested, JavaScript-based HTML minifier with extensive optimization options
86
Transforms HTML markup into a compact form for client responses while keeping semantic meaning intact. All transformations apply by default; setting collapse, simplifyDoctype, or compressAssets to false skips that step.
<div>\n <!-- hero banner -->\n <span> Hi there </span>\n</div> becomes <div><span>Hi there</span></div> @test<button type="submit" disabled="disabled">Send</button> becomes <button disabled>Send</button> @test<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"><html><body><br/></body></html> becomes <!doctype html><br> @test<style> body { color: red; padding: 0 8px; } </style><script> function hi(){ console.log('ok'); } </script> becomes <style>body{color:red;padding:0 8px}</style><script>function hi(){console.log("ok")}</script> @test@generates
export interface MinifyRequest {
html: string;
collapse?: boolean;
simplifyDoctype?: boolean;
compressAssets?: boolean;
}
export function minifyResponse(input: MinifyRequest): string;Provides HTML, attribute, and inline CSS/JS minification.
Install with Tessl CLI
npx tessl i tessl/npm-html-minifierdocs
evals
scenario-1
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9