#css purging
7 messages · Page 1 of 1 (latest)
Hi @marsh trench. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
The knowledge sources do not explicitly mention any built‑in CSS “purging” (tree‑shaking of unused selectors) being done by Astro v5 during build.
What Astro does by default is:
- Bundle, split, and inline/externalize CSS based on size (
inlineStylesheets+ Vite’sassetsInlineLimit). [Production styling; inlineStyleSheets change] - Optimize CSS delivery (chunking, minification), but not remove unused selectors according to the docs we have.
If you want actual CSS purging, the integrations list shows community plugins like astro-purgecss-static and @zokki/astro-purgecss specifically for removing unused CSS from Astro static builds. [Integrations list]
So, based on the provided docs: no, Astro v5 does not purge unused CSS by default; you’d need an additional tool/integration for that.
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
@marsh trench Kapa.ai is still learning and improving, please let me know how I did by reacting below.
@mild wagon so to be clear, astro wont remove unused scss rules by default in build process?
Let me check the knowledge base for you again. One moment! :books:
Based on the docs available, there is no mention that Astro’s build process removes unused CSS/SCSS rules by default.
What Astro does do automatically is:
- Bundle, split, and minify your CSS for production, and decide whether to inline or externalize stylesheets based on size. [Production styling; inlineStylesheets option]
But actual “purging” (removing unused selectors) is only referenced via community integrations like astro-purgecss-static and @zokki/astro-purgecss, which exist specifically to remove unused CSS from Astro static builds. [PurgeCSS integrations]