Any interest in integrating WyW-in-JS for a zero runtime option? #5673
miloofcroton
started this conversation in
General
Replies: 0 comments
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.
-
This library (https://wyw-in-js.dev/) powers Linaria (https://linaria.dev/) among a few other libraries, but Linaria specifically is the closest to styled-component syntax with zero runtime. This has performance benefits but also a few drawbacks, such as limiting your project to whatever can support wyw-in-js (which I believe excludes react native) and the smaller subset of valid syntax in Linaria. This smaller syntax amounts to doing things less dynamically, or at least doing dynamic things in a very specific way that still allows for compile time extraction.
I have considered simply passing in a module at compile time that would allow me to switch between Linaria and styled-components (essentially by defining where the
cssprop parsing function comes from), but this may be a little ugly for my tastes.I've also started wondering if styled-components could simply support both functions internally by adding an option that lets you switch to using wyw-in-js under the hood. I don't know the architecture of styled-components to say how big of a lift this would be, but I'd like to raise the issue and do a little investigation myself.
Beta Was this translation helpful? Give feedback.
All reactions