styled-components / babel-plugin-styled-components

Improve the debugging experience and add server-side rendering support to styled-components
MIT License
1.07k stars 139 forks source link

minifier removes space between & and ::after #366

Closed agriffis closed 2 years ago

agriffis commented 2 years ago

There's a bug reported against SWC because it works differently from this plugin, but AFAICT the bug is in the plugin, not SWC.

Report: https://github.com/vercel/next.js/issues/30802#issuecomment-990960985 My response: https://github.com/vercel/next.js/issues/30802#issuecomment-992766906

Basically when the minifier encounters .globalClass & ::after it kills the space between the ampersand and the colons.

jukkah commented 2 years ago

I have the same problem with & :not(:last-child). Also tested with some other selectors.

Context: In my case (https://github.com/vrk-kpa/suomifi-ui-components/blob/v7.0.0-beta.1/src/core/Form/FilterInput/FilterInput.baseStyles.tsx#L39) I'm trying to add separator between items. But after minification the selector matches to the parent element instead of the items.

agriffis commented 2 years ago

Fixed by #376 and released in v2.0.7