Replies: 3 comments 1 reply
-
With v4 the amount of unused css variables have gone up by a lot - for my project just those unused variables are about 31% of the total CSS (12kb of 38kb, minified build), I have been removing those 12kb with https://github.com/tomasklaen/postcss-prune-var so far but it would be nice if TailwindCSS could provide some native optimizations to reduce this, as even with the remaining code I am sure a lot of it is probably unnecessary/could be removed for my projects: In v3 the total CSS size for my project was 22kb (with no removing of unused variables or any other special optimizations outside of Tailwind), in v4 it went up to 38kb and even with unused variables removed it is at 26kb. |
Beta Was this translation helpful? Give feedback.
-
Thank you for sharing @madmoizo Before: 17.29 |
Beta Was this translation helpful? Give feedback.
-
This feature is supported since Tailwind CSS v4.0.5 |
Beta Was this translation helpful? Give feedback.
-
I'm sure it will be built-in at some point but for now if someone wants to optimize the css output by removing unused css var, here is a little vite plugin I made:
https://github.com/madmoizo/vite-plugin-tailwindcss-cleaner
Beta Was this translation helpful? Give feedback.
All reactions