babel-plugin-styled-components icon indicating copy to clipboard operation
babel-plugin-styled-components copied to clipboard

Plugin breaks 'stylis-plugin-rtl' with /* @noflip */ comment when minifying the styles

Open ccpu opened this issue 5 years ago • 2 comments
trafficstars

I am using stylis-plugin-rtl to convert CSS stylesheets between ltr and rtl.

stylis-plugin-rtl plugin internally uses cssjanus to flip the styles.

cssjanus comes with special comment /* @noflip */ to protect a rule from being changed.

Apparently @noflip will not work when using babel-plugin-styled-components with minify: true. I think that's because it will be removed by the plugin as part of the minification process.

So wondering how is it possible to minify the styles and also be able to use /* @noflip */ comment to prevent flipping a rule?

ccpu avatar Jan 15 '20 14:01 ccpu

You could probably make a PR against the Babel plugin to not strip that particular comment

Sent from my iPhone

On Jan 15, 2020, at 9:24 AM, cyrus [email protected] wrote:

 I am using stylis-plugin-rtl to convert CSS stylesheets between ltr and rtl.

stylis-plugin-rtl plugin internally uses cssjanus to flip the styles.

cssjanus comes with special comment /* @noflip */ to protect a rule from being changed.

Apparently @noflip will not work when using babel-plugin-styled-components with minify: true. I think that's because it will be removed by the plugin as part of the minification process.

So wondering how is it possible to minify the styles and also be able to use /* @noflip */ comment to prevent flipping a rule?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or unsubscribe.

quantizor avatar Jan 15 '20 14:01 quantizor

thanks for the advice, I will look into it when I get a chance.

ccpu avatar Jan 15 '20 14:01 ccpu