Min
Extremely β‘ Fast and Smart HTML π JS π‘ CSS π΅ SVG π£ Minification
Install / Use
/learn @advanced-astro/MinREADME
β³ 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 π±
- [x] HTML, CSS, JS, SVG
- [x] Files and inline Code
- [x] Static Site Minification
Note
astro-minfocuses on compressing statically generated content and pre-rendered routes
- [ ] Support SSR / Hybrid Rendering
- [ ] Remove Comments from external CSS/JS
Getting started π―
Use your package manager of your choice
# NPM
npm run astro add astro-min
# Bun (known bug π)
#bun astro add astro-min
# PNPM
pnpm astro add astro-min
# Yarn
yarn astro add astro-min
Manual Installation π§βπ»
-
Install package
astro-min -
Import and add to integrations list
//astro.config.mjs
import { defineConfig } from 'astro/config'
import min from 'astro-min'
export default defineConfig({
integrations: [min()]
})
Options π§
//astro.config.mjs
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-minlast in your integration list for the best optimization
Optional: but beforeastro-compressorandastro-compressfor images only
//astro.config.mjs
import { defineConfig } from 'astro/config'
import compressor from 'astro-compressor'
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,
}),
compress({
CSS: false,
HTML: false,
Image: true,
JavaScript: false,
SVG: false
}),
compressor()
]
})
Development π»
Learn more π
Versus π
-
- π uses terser based on javascript
- π€ lightningcss not yet implemented
-
- π uses terser based on javascript
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
Related Skills
node-connect
342.0kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
84.7kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
342.0kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
commit-push-pr
84.7kCommit, push, and open a PR
