β³ AstroMin
Extremely fast and smartπΉ Minification of π HTML π‘ JS π΅ CSS π£ SVG
Meticulously optimized for Speed π₯ and Effectiveness π
based on Rust π¦

Feature Highlights β¨
- β‘ Performant parallel processing (+1k files/s)
- πͺΆ Lighter build output (~25% smaller)
- π¦ small packaged size (~30KB)
Feature Roadmap π±
Note
astro-min
focuses on compressing statically generated content and pre-rendered routes
Getting started π―
Use your package manager of your choice
npm run astro add astro-min
pnpm astro add astro-min
yarn astro add astro-min
Manual Installation π§βπ»
import { defineConfig } from 'astro/config'
import min from 'astro-min'
export default defineConfig({
integrations: [min()]
})
Options π§
import { defineConfig } from 'astro/config'
import minify from 'astro-min'
export default defineConfig({
integrations: [
minify({
do_not_minify_doctype: false,
ensure_spec_compliant_unquoted_attribute_values: false,
keep_closing_tags: false,
keep_comments: false,
keep_html_and_head_opening_tags: false,
keep_input_type_text_attr: false,
keep_spaces_between_attributes: false,
keep_ssi_comments: false,
minify_css: false,
minify_js: false,
preserve_brace_template_syntax: false,
preserve_chevron_percent_template_syntax: false,
remove_bangs: false,
remove_processing_instructions: false,
})
]
})
[!IMPORTANT]
Use astro-min
last in your integration list for the best optimization
Optional: but before astro-compressor
and astro-compress
for images only
import { defineConfig } from 'astro/config'
import compressor from 'astro-compressor'
import minify from 'astro-min'
export default defineConfig({
integrations: [
minify({
}),
compress({
CSS: false,
HTML: false,
Image: true,
JavaScript: false,
SVG: false
}),
compressor()
]
})
Development π»

Learn more π
Versus π
Colophon π
Build with modern FOSS π and AI assistance π€
Next generation β¨ web development based on Rust π¦
Changelog π
1.2.0 - π Feat: Parallel processing
- β¨ Feat: Skip *.min.*
1.1.0 - π Fix: Auto install bug
Advanced Astro