-
Theme UI is for me by far the best UI library I've used. But one point I'm strongly considering for my recent applications is having a static extract of my CSS, with zero or low run-time. Is it something the library creators are considering or is there already any approach or similar library doing this? I've recently used treat for reference. Thanks in advance! |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
Hi! Theme UI is built on top of Emotion, and AFAIK it can't be statically extracted.
@compiled/css-in-js has statically extracted CSS prop. If you knew the theme statically, it would possible to write a TS transform / babel plugin to compile It would look kind of like this: https://github.com/atlassian-labs/compiled-css-in-js/blob/master/packages/ts-transform/src/utils/object-literal-to-css.tsx |
Beta Was this translation helpful? Give feedback.
-
Calico seems to be the solution for statically generate css from predefined theme object. |
Beta Was this translation helpful? Give feedback.
Hi! Theme UI is built on top of Emotion, and AFAIK it can't be statically extracted.
sx
props intoclassName
at runtime.@compiled/css-in-js has statically extracted CSS prop. If you knew the theme statically, it would possible to write a TS transform / babel plugin to compile
sx
prop intocss
prop and then run @compiled/css-in-js, but this is honestly a big undertaking.It would look kind of like this: https://github.com/atlassian-labs/compiled-css-in-js/blob/master/packages/ts-transform/src/utils/object-literal-to-css.tsx