HTML minifier for statically rendered files in Astro.
# Using npm
npx astro add @frontendista/astro-html-minify
# Using yarn
yarn astro add @frontendista/astro-html-minify
# Using pnpm
pnpx astro add @frontendista/astro-html-minify
# Using npm
npm install --save-dev @frontendista/astro-html-minify
# Using npm
yarn add -D @frontendista/astro-html-minify
# Using npm
pnpm add -D @frontendista/astro-html-minify
Default import the integration and add it to integrations
key in your astro.config.{mjs,js,ts}
configuration.
import { defineConfig } from "astro/config";
import minify from "@frontendista/astro-html-minify";
export default defineConfig({
integrations: [minify()]
});
import { defineConfig } from "astro/config";
import minify from "@frontendista/astro-html-minify";
export default defineConfig({
integrations: [
minify({
html: {
// Customize Terser options
},
css: {
// Customize LightningCSS options
},
js: {
// Customize ESBuild options
}
})
]
});