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

fix(emotion): use swc_css to minify css string #228

Closed
wants to merge 1 commit into from

Conversation

JSerFeng
Copy link
Contributor

@JSerFeng JSerFeng commented Nov 6, 2023

Use swc_css to minify css string in emotion

Use swc_css to minify css string and remove comments

Reason

There are some old projects using emotion@10, and emotion10 runtime cannot handle comments correctly, emotion babel plugin can remove all comments in the css string so it is fine when using babel.

Benefits:

No need to use regex
Can strip comments like @emotion/babel-plugin

Questions:

I wrap the original css string in a selector to make parser works correct, not sure if swc_css has some API to parse css string like color: red instead of .sel { color: red }.

The should_not_trim_end_space_in_first_item test failed, it removes the last space, is this OK?

@JSerFeng JSerFeng closed this Nov 6, 2023
@kdy1 kdy1 self-assigned this Mar 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants