stitchesjs / stitches

[Not Actively Maintained] CSS-in-JS with near-zero runtime, SSR, multi-variant support, and a best-in-class developer experience.
https://stitches.dev
MIT License
7.73k stars 249 forks source link

Namespace #1057

Closed nc closed 1 year ago

nc commented 2 years ago

Is your feature request related to a problem? Please describe. I have stitches being used by two different component libraries on the same page, and they are clashing.

Describe the solution you'd like A way to define a namespace. Like a theme, but for isolating themes too.

Describe alternatives you've considered Namespacing variables with $libName$accent$1 etc. A bit too wordy.

Additional context N/A

KXLAA commented 2 years ago

You can prefix the CSS variable names in your createStitches function. I think this should solve clashing styles

For example:

const { theme } = createStitches({ prefix: "your-prefix", theme: {...} })

see more here

hadihallak commented 1 year ago

As @KXLAA mentioned, a prefix is already supported.