-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Components: moving away from Emotion #66806
Comments
Update: Folks from @WordPress/gutenberg-components spent some time in the past couple of days testing a few approaches. Long-term goalAs the long-term solution, we discussed replacing Emotion with CSS modules. @mirka started experimenting with adding the necessary steps to the Goals:
One thing to consider is whether we should use "SCSS" modules instead so that all styles are authored in SCSS across the whole repository. Using SCSS will also allow us to re-use SCSS variables, without the need for re-creating them in another language (as we currently do with JS variables for CSS-in-JS styles). Intermediate stepWe discussed applying an intermediate step, where we'd keep the CSS-in-JS code as "untouched" and possible, and we'd focus on swapping Emotion with another (zero-runtime) CSS-in-JS. We looked at linaria, StyleX, and vanilla-extract.
For the above reasons, @ciampo 's initial conclusion is that it may be a better strategy to skip the intermediate step, and instead refactor the Emotion code directly to whatever long-term solution we want to adopt (eg. CSS modules). |
Related to #61232
Goal
Context
The
@wordpress/components
and the@wordpress/block-editor
packages use the Emotion for authoring styles.Emotion is a CSS-in-JS library that dynamically computes and applies styles at runtime, allowing a developer to change the styles based on JS variables / react props. It also allows for locally scoped files (obfuscating classnames), and colocation of styles and markup.
Unfortunately, Emotion also has a few drawbacks:
cc @WordPress/gutenberg-components
The text was updated successfully, but these errors were encountered: