Replies: 1 comment 2 replies
-
Hey 👋 This kind of API would force us to use AST manipulation to achieve, which is against the core idea's of vanilla-extract. This is what allows us to support things like esbuild, plus this kind of API seems simple in demo's but has seemingly-infinite edge cases in reality. Vanilla-extract will always force your styles to be inside a separate .css.ts file. If you want to continue using vanilla-extract then I'd suggest checking out Sprinkles and Recipes if you haven't already. I think they help to get passed this issue a lot. If you can't get passed not having inline style definitions then check out compiled or linaria who use this style of approach with different trade-offs. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I'm in love with this library. There's just this little thing on my mind. One of the (probably, the only, compared to vanilla-extract) benefits of libraries such as Tailwind and Emotion is that they don't require coming up with intermediate variable names for the classes / components. What if we could do this with vanilla-extract?
(I've tried, but this sadly doesn't work)
I'm not talking about having special React support here. As long as all calls to
style()
can be replaced with their string class name values, rather than only those made at the top level, nothing else would need to be done to support React. I guess the same applies to other APIs.Of course, a gotcha here would be that we can't pass any variables anywhere to style that are not defined globally. But this can probably be determined during the build.
Has this been considered?
Beta Was this translation helpful? Give feedback.
All reactions