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

cssnano calc will break the Radio style #961

Closed
djyde opened this issue Aug 14, 2020 · 6 comments
Closed

cssnano calc will break the Radio style #961

djyde opened this issue Aug 14, 2020 · 6 comments

Comments

@djyde
Copy link

djyde commented Aug 14, 2020

It's not a bug. But I spend some time figure out how thing was happend. Hope this issue could save someone's time.

I found when I cssnano my css, the Radio will become:

image

And I tried to disable some cssnano optimization option and finally figure out is the calc rule break this.

Different part:

image

@snowystinger
Copy link
Member

We've had some issues with cssnano in the past, you might try a different version as well. Or the upstream postcss-calc.
I don't recognize this particular one, it might be helpful if you could log a bug with one of those projects

@devongovett
Copy link
Member

@mischnic
Copy link
Contributor

mischnic commented Aug 26, 2020

underlying postcss-calc issue: postcss/postcss-calc#107

@itaylor
Copy link
Member

itaylor commented Sep 1, 2020

Might be worth noting that this happens to apps built using create-react-app out of the box, but only in production mode, not developer mode. I tried, but couldn't find a way to change the config without ejecting the create-react-app config and modifying the webpack configuration.

If you're using cra want to work the bug, around first yarn eject your create-react-app, then modify the config/webpack.config.js file. Change the settings for the default preset of cssProcessorPluginOptions under the OptimizeCSSAssetsPlugin to include calc: false,

Here's what my fixed version of that section looks like:

cssProcessorPluginOptions: {
  preset: ['default', { calc: false, minifyFontValues: { removeQuotes: false } }],
},

@mischnic
Copy link
Contributor

mischnic commented Sep 1, 2020

I've opened a PR for postcss-calc to fix this: postcss/postcss-calc#114

@mischnic
Copy link
Contributor

mischnic commented Sep 1, 2020

I've just verified that this is fixed with cssnano 7.0.4. Bump your lockfile

@mischnic mischnic closed this as completed Sep 1, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants