Skip to content
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

Migrate from Glamor to Emotion #701

Closed
j-f1 opened this issue Feb 27, 2023 · 5 comments
Closed

Migrate from Glamor to Emotion #701

j-f1 opened this issue Feb 27, 2023 · 5 comments
Labels
tech debt Technical debt we should pay down

Comments

@j-f1
Copy link
Contributor

j-f1 commented Feb 27, 2023

Glamor was last updated in 2017, and Emotion is a popular and actively maintained alternative that remains largely compatible with Glamor’s APIs.

@j-f1 j-f1 added the tech debt Technical debt we should pay down label Feb 27, 2023
@j-f1 j-f1 removed the needs triage label Feb 27, 2023
@albertogasparin
Copy link
Contributor

Might be able to tackle this one sometime in the future (especially because glamor types are basically any 🤦 ), but first wanna make sure we know what we are getting into. The reason is that with React 18 and some of the work behind SSR/server components/concurrent features a lot of CSS-in-JS solutions out there are currently struggling.
[Important: I'm not listing any framework, eg Tailwind, as that is a different conversation]

⚠️ Emotion
Still on R16 and SSR not working properly (see issues), probably due to lack of resources. Thinkmill (main sponsor) is re-prioritising things, another main sponsors left and chakra-ui is also moving away from it. We might not face those challenges, but I think it is still worth mentioning.

⚠️ styled-components
A new version (v6) is in the works, but still beta and unclear whenever performance (currently 20% slower), full R18 support and stable API will come.

⚠️ compiled
Atlassian is investing in it, but there is no real community and official R18 support will come later this year. It is also optimised for large apps, so might not offer the be the best output.

👀 vanilla-extract
Slightly different and with no specific React binding, it has a very nice, type safe theming API (compared to the handmade once we currently have) but it is less known and might cause friction to casual contributors.

👀 linaria
Currently having momentum, but it is very strict on the feature set (eg no dynamic styles).

Ⓜ️ CSS modules
"Old, boring" tech that however still delivers best value in terms of performance and flexibility. Needs to be strongly linted to stop devs from writing bad CSS, and TS support is editor only but it is here to stay.

🔴 stitches
Seems stopped and in maintenance mode, plus current version does not support SSR properly

There are more (new ones being build every other week) but I think I covered the main ones. Outcome: seems like a quite uncertain period. Probably using anything with css is fine as we can easily migrate between libraries, but I'd recommend to stick to widely supported features so migration between libs (if necessary) is easier.

Also, any particular reason why we would prefer emotion to styled-components? SC is more popular and has better community support.

@j-f1
Copy link
Contributor Author

j-f1 commented May 2, 2023

The reason is that with React 18 and some of the work behind SSR/server components/concurrent features a lot of CSS-in-JS solutions out there are currently struggling.

Fortunately Actual is entirely a client rendered app (I don’t see server rendering as something that would make things much better given how the app is set up). Concurrent rendering could be nice but I also don’t think we would have a problem staying away from that if we wanted to.

Also, any particular reason why we would prefer emotion to styled-components? SC is more popular and has better community support.

When I looked at styled-components, it seemed like we would need to change a ton of existing code, while Emotion is inspired by Glamor and therefore has a very similar API. (For example, I don’t think SC supports sub selectors using the object syntax?).

@maxichrome
Copy link

Just passing by on my way through an entirely unrelated issue on an unrelated project, to shed some light on this specific bit:

(For example, I don’t think SC supports sub selectors using the object syntax?)

I edited the Style Objects example on styled-components' example to contain a child and it seems to work just fine:

Style Objects documentation with an edited example showing a child component referenced in a style object via bracket notation reflecting its parent-defined style as expected Here, the child component has been modified by its parent to show yellow text instead of the child's self-defined red.

@youngcw
Copy link
Member

youngcw commented Oct 18, 2024

@joel-jeremy Can this be closed now?

@youngcw
Copy link
Member

youngcw commented Nov 4, 2024

completed by #3471

@youngcw youngcw closed this as completed Nov 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tech debt Technical debt we should pay down
Projects
None yet
Development

No branches or pull requests

4 participants