Skip to content

Using StyleX in design system? #228

Answered by nmn
simpel asked this question in Q&A
Dec 21, 2023 · 2 comments · 6 replies
Discussion options

You must be logged in to vote

The process works exactly how @stylexjs/open-props works in the NextJS example. Here's the TLDR;

  1. The consumers of your component library will need to setup StyleX in their own application. Even if they don't use StyleX directly.
  2. Then styleX will compile any file, including within node_modules that uses StyleX and extract the relevant CSS.
  3. The bundle generated for them will only include styles for the components they import.

So, don't worry, the consumers will only pay for what they use. And if they're using StyleX for their own projects, the costs for all the common CSS will be shared.


Some things to remember:

  • You probably still want to run Autoprefixr on the generated CSS file if you…

Replies: 2 comments 6 replies

Comment options

You must be logged in to vote
1 reply
@simpel
Comment options

Answer selected by nmn
Comment options

You must be logged in to vote
5 replies
@nmn
Comment options

@olivierpascal
Comment options

@nmn
Comment options

@olivierpascal
Comment options

@olivierpascal
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants