Replies: 1 comment
-
Okay I guess https://www.npmjs.com/package/@tailwindcss/jit exists which sounds like its ditching build time generation for run time generation and seems to have been pitched as the future of Tailwindcss but for some reason it still depends on postcss and the main tailwindcss package and also nobody seems to be using it (6k vs 10M weekly downloads on NPM) after existing for 4 years. What's going on there? |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I'm trying to understand the trade off from the title. Generating classes (or rather deleting unused classes) at build time has the drawback that it requires static code analysis which is complicated and imperfect. E.g. it currently interferes with assigning classes dynamically even in relatively simple cases. So instead, why aren't the necessary classes generated at run time? E.g. assume we only care about making it work for React. We could hook into the render process, observe all the class names and generate them. Sounds complicated but it isn't really, especially compared to the rest of the React render process. The mapping from Tailwind class names to css is super trivial, e.g. the margin classes
m-${size}
simply map tomargin: ${size * 0.25}rem
and once the class has been generated the only overhead left would be the hash map lookup for the fact that it already has been generated. What am I missing?Beta Was this translation helpful? Give feedback.
All reactions