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

Remove runtime css-in-js from the project #177

Open
cseas opened this issue Jan 12, 2023 · 2 comments
Open

Remove runtime css-in-js from the project #177

cseas opened this issue Jan 12, 2023 · 2 comments
Assignees
Labels
feature-request Request for a new feature

Comments

@cseas
Copy link
Collaborator

cseas commented Jan 12, 2023

CSS in JS is bad for perf. There are workarounds to improve its performance but instead of spending time fixing problems introduced by CSS in JS, it's better to remove the problem at the root level and switch to generating CSS at compile time instead of runtime.

Proposing to remove styled-components and replace it with a compiled CSS solution such as Vanilla Extract (Seek), Compiled (Atlassian), Stylex (Facebook), etc.

Vanilla Extract seems to be the best alternative right now since it works very similar to Sass and provides type safety for CSS. However, the challenge is that Vanilla Extract requires a bundler:
vanilla-extract-css/vanilla-extract#90 (comment)

Webpack doesn't currently have a way to ship an ESM library with the original tree but there are plans of implementing it: webpack/webpack#2933 (comment)

Rollup can ship ESM with preserveModules but I'd like to avoid diving into its ecosystem because it requires a lot of third-party plugins to work with TypeScript correctly. The app part in this project is already built with webpack so it'd be easier to just reuse that config instead of building with a completely separate bundler.

Need to revisit this when Webpack has a way to ship ESM lib with original tree.

@cseas cseas added the feature-request Request for a new feature label Jan 12, 2023
@cseas cseas self-assigned this Jan 12, 2023
@cseas cseas changed the title Remove css-in-js from the project Remove runtime css-in-js from the project Jan 13, 2023
@cseas
Copy link
Collaborator Author

cseas commented Jan 26, 2023

This is done for Anchor component. Other components to be migrated same way.

@cseas cseas added this to the Remove CSS in JS milestone Feb 1, 2023
@cseas
Copy link
Collaborator Author

cseas commented Feb 1, 2023

Need to take Typography next. It's needed to move the home page of my blog to server components.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request Request for a new feature
Projects
None yet
Development

No branches or pull requests

1 participant