Strategies to avoid combinatorial explosions for tokens & states #32
-
Hello there! 👋 I'm currently working on a Conceptually this component should be fairly close to offering tailwind-style classes via props. This should also include stuff like hover/focus state and media queries. But a naïve implementation will of course also come with a drawback of tailwind. Depending on the amount of tokens and states a lot of classes will be generated, of which only few will be used. Tailwind incorporates PurgeCSS to solve this issue. But I don't think that approach is viable using vanilla-extract. Do you have any strategies in mind for how this could be solved using vanilla-extract? Cheers, PS: Last week we managed to complete our migration from treat to vanilla-extract. I guess you can call the library production ready :) |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
Congrats on the migration! That's awesome 👏 The way we deal with this is to only put things on For example, only some of our props support responsive arrays, e.g. in our system |
Beta Was this translation helpful? Give feedback.
Congrats on the migration! That's awesome 👏
The way we deal with this is to only put things on
Box
that are very commonly needed. This can also be evaluated for each individual prop, which helps cut down on the combinatorial explosion.For example, only some of our props support responsive arrays, e.g. in our system
padding
is a responsive prop butbackground
isn't because we very rarely change colours responsively. In addition, looking at your example, I'd say you might find that only some of your props need hover/focus support too.