-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Are Glamor vs. Emotion's object syntax the same? #631
Comments
They're very similar, most projects will be able to switch without changing any styles. There are some slight differences, currently emotion doesn't support array fallbacks but I just opened #634 to address that and emotion doesn't stringify values for There are also some small differences in how the css prop works between glamor and emotion. Firstly, emotion's css prop currently works by transforming the css prop to a className prop in a babel plugin so spreading an object with a css key doesn't work. This is likely going to change soon, you can see what it's probably going to look like in https://github.com/emotion-js/next. The other difference is that emotion classNames passed take precedence over the styles passed to the css prop, this is so that you can override a components styles by using the css prop with it. For example, the example below is hotpink in emotion and green in glamor const SomeComponent = ({ className }) => (
<div css={{ color: "green" }} className={className} />
);
render(<SomeComponent css={{ color: "hotpink" }} />); |
Closed in #633. If you have any more questions @KyleAMathews lmk. |
Thanks for the detailed response! Looks like it'd pretty easy to switch. |
E.g. can I switch from using Glamor's css prop to Emotion's?
The text was updated successfully, but these errors were encountered: