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

styled-components minify doesn't work with provided target #143

Closed
huv1k opened this issue Jan 27, 2023 · 2 comments · Fixed by #235
Closed

styled-components minify doesn't work with provided target #143

huv1k opened this issue Jan 27, 2023 · 2 comments · Fixed by #235

Comments

@huv1k
Copy link

huv1k commented Jan 27, 2023

Hey, I was trying out @swc/plugin-styled-components, but compiled output with selected target es2020 doesn't remove comments and white spaces. Here is repo with reproduction.

For input, I used input from tests and output is like this. Comments are still presented and output inside template literals is not minified.

How to reproduce

  1. Clone repro
  2. yarn install
  3. yarn run compile
@phiter
Copy link

phiter commented May 26, 2023

Yeah, I'm trying out the plugin and minification doesn't seem to be working yet. The file is empty:

@kdy1 sorry for pinging you. Are there any plans to implement this?

@kwonoj
Copy link
Member

kwonoj commented May 26, 2023

There are no immediate plans as we have higher priorities. Happy to accept PR.

@kdy1 kdy1 closed this as completed in #235 Nov 23, 2023
kdy1 pushed a commit that referenced this issue Nov 23, 2023
This implements `minify` option in styled-components plugin. The
minification algorithm and unit tests are ported from
`babel-plugin-styled-components`.

Note that CSS code in helper functions (`keyframes`, `css`, etc.) are
currently not always processed. I think there is a bug in `is_helper`
function, so I'll fix it in another pull request later.

fixes #143
cf. vercel/next.js#30802
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging a pull request may close this issue.

3 participants