-
Below is compiled tailwind 3 from one of my recent app: As you can see, Now, I haven't changed anything in my app, I just migrated to Yes Right! it's like a dozen times bigger... and I am not sure to understand the reasons because a lot of this code seems unecessary (lots of colors vars I don't even use.) Update: I understand now why is this code injected in final build, I just wish there were an easy way to prevent that for the people that might just want to use TW4 for the layouts. In TW3 it was as easy as writting |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 11 replies
-
As per the documentation:
|
Beta Was this translation helpful? Give feedback.
-
I am also not a fan of the amount of variables that are defined in v4 and no options to remove the unused ones, as it increased my CSS (going from v3 to v4) from 22kb to 38kb, most of it because of the CSS variables. My current solution is to use https://github.com/tomasklaen/postcss-prune-var , which removes unused CSS variables, but Tailwind could probably do a better job itself. I hope optimization/smaller CSS amount becomes a bigger priority now that v4 is out. |
Beta Was this translation helpful? Give feedback.
-
I found an opt-in solution to this by selectively disabling all predefined features (Thanks @wongjn to show me how). @import 'tailwindcss';
@theme {
--animate-*: initial;
--aspect-*: initial;
--blur-*: initial;
--breakpoint-*: initial;
--color-*: initial;
--container-*: initial;
--default-*: initial;
--drop-*: initial;
--ease-*: initial;
--font-*: initial;
--font-weight-*: initial;
--inset-shadow-*: initial;
--leading-*: initial;
--perspective-*: initial;
--radius-*: initial;
--shadow-*: initial;
--text-*: initial;
--tracking-*: initial;
} Now during development if you ever need a set, let say text sizes you would comment |
Beta Was this translation helpful? Give feedback.
I found an opt-in solution to this by selectively disabling all predefined features (Thanks @wongjn to show me how).
Now during development if you ever need a set, let say text sizes you would comment
--text-*: initial
to make the classes available …