Replies: 2 comments 3 replies
-
Hey @macrini thanks for the post! It is an interesting idea however just because we can do something doesn't mean we should. I'm curious to see if anyone else would benefit from such an approach as I imagine it would be quite an involved change to Twind core. Another thing I'd suggest is just giving it a go! Try bolt on Twind to an existing Tailwind project and see what happens, note down any issues like style conflicts or precedence overloads etc. The runtime cost of double generation is indeed a thing but it shouldn't be of concern. I'm struggling to find any upsides to a top down approach (with purging) since trying bottom up ones, doing both feels like you would suffer the downsides of both as well as the upsides, this might work out to be a net negative. |
Beta Was this translation helpful? Give feedback.
-
Thanks for the detailed write-up. I've added my thoughts inline...
I agree that this is possible.
Is there currently an issue with having tailwind and twind on the same page? If there is twind could be configured to hash its classNames.
Totally agree.
2 – 5 are pointing to a problem using tailwind and twind together. What problem have you found? We want to support this.
If tailwindcss is used those classes are already available. For a twind only site this can be achieved using static extraction which would only include the classes that are used within the html.
I agree. Generate minimal static css using tailwindcss and use twind to provide the dynamic classes. Sounds good.
That may be the case. I just do not see how analyzing the existing stylesheet would help. Sorry. Maybe i'm totally missing the point. |
Beta Was this translation helpful? Give feedback.
-
The proposal is to add an option to check if a css class exists in the style sheets before creating it. For example, using https://developer.mozilla.org/en-US/docs/Web/API/StyleSheetList, or some other method.
The objective is to allow for build-time Tailwind classes to co-exist with runtime classes. The check results can be cached so that each class is checked at most once.
Advantages
It might be the case that after using a hybrid approach, a team might end up converging to either pure-build-time or pure-runtime classes. The main point being that it gives a dev team the option to experiment with both approach without changing existing code. It might also be that there are apps in which a pure approach is not optimal, and the only optimal solution is a hybrid one.
Beta Was this translation helpful? Give feedback.
All reactions