Replies: 1 comment
-
I have now created a package for this! https://www.npmjs.com/package/vanilla-extract-recipe-factory |
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
-
I'd love to be able to combine the strict conventions of atomic css (Sprinkles) with the flexibility of variants (Recipes). I believe we're very close to be able to do it as well. If we could refactor the internals of the recipes package to allow us to customize how a recipe's style is compiled, it would unlock very powerful composition abilities. Here's some pseudo code to illustrate what I'm imagining:
This approach would only make Recipes more flexible and still be backwards compatible. Sprinkles and Recipes would still be unaware of each other, but Recipes would become flexible enough to be able to compose them together.
Here's how you can recreate the built-in
recipe
function using this new factory:I created a POC for this factory approach here, where I tested both using
sprinkles
andstyle
as input for the factory, and it works great so far: https://github.com/ksandin/yas/blob/master/tools/vanilla-extract-recipe-factory/src/index.tsI could publish this as a new package, but I really think it would be super addition to @vanilla-extract/recipes out of the box. It would also be less brittle if it was integrated in the core package, since my POC demonstrates that building something like this requires assuming a lot of both runtime and type implementation details.
Beta Was this translation helpful? Give feedback.
All reactions