An Astro integration that minifies static HTML output using html-minifier-terser at build time. Current stable version is 0.1.1, released as an early-stage package with no breaking changes reported. It provides a simple integration function that wraps html-minifier-terser options, allowing removal of comments, whitespace, and other optimizations. Unlike raw usage of html-minifier-terser, this integration automatically hooks into Astro's build pipeline and applies minification to all generated HTML pages with zero configuration required.
npm install astro-minify-htmlNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Configures Astro to minify HTML output, removing comments, collapsing whitespace, and minifying inline CSS/JS.
Ensure your Astro project uses output: 'static' and does not use server-side rendering for pages you want minified.
Test minification options thoroughly in a staging environment. Refer to html-minifier-terser docs for known caveats.
This is by design. To see minified output, run 'astro build' and inspect the dist folder.
Pin to exact version in package.json to avoid unexpected changes.
Use 'import { minifyHtml } from 'astro-minify-html'Use dynamic import: 'const { minifyHtml } = await import('astro-minify-html')'