@frontendista/astro-html-minify
TypeScript icon, indicating that this package has built-in type declarations

2.0.0 • Public • Published

Astro HTML minify

HTML minifier for statically rendered files in Astro.

1. Usage

1.1 Using astro add command

# 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

1.2 Manually

1.2.1 Install dependency

# 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

1.2.2 Add to configuration

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()]
});

1.3 Customize minifiers options

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
			}
		})
	]
});

Package Sidebar

Install

npm i @frontendista/astro-html-minify

Weekly Downloads

30

Version

2.0.0

License

MIT

Unpacked Size

4.94 kB

Total Files

5

Last publish

Collaborators

  • pavelsusicky