-
Notifications
You must be signed in to change notification settings - Fork 9
refactor(components): use vanilla-extract for styles #1124
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
🦋 Changeset detectedLatest commit: a1157d7 The changes in this PR will be included in the next version bump. This PR includes changesets to release 42 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
| selectors: { | ||
| ['[data-theme="dark"] &']: { | ||
| vars: { [accentVar]: vars.color.pink[200] }, | ||
| }, | ||
| }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Simple example of how to tweak a local CSS custom property (component-level token) for dark mode.
|
Size Change: -4.25 kB (-2%) Total Size: 191 kB
ℹ️ View Unchanged
|
Summary
While StyleX provides some nice optimizations via atomic CSS, a couple drawbacks became apparent when trying to create styles for buttons: debugging the long list of classes via the browser dev tools is a pain (common for all atomic CSS solutions) and there isn't a way to target ancestor selectors (in this case dark mode via data-theme attr) for styles. Vanilla Extract does not have either of these issues and makes it easy to define locally scoped CSS custom properties. I believe VE's versatility and wider feature set at the expense of a larger CSS bundle size is a better fit for our needs in the long run.