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

Nested calcs are optimized away incorrectly by cssnano #1295

Closed
dgutride opened this issue Jan 24, 2019 · 4 comments
Closed

Nested calcs are optimized away incorrectly by cssnano #1295

dgutride opened this issue Jan 24, 2019 · 4 comments
Labels
wontfix This will not be worked on

Comments

@dgutride
Copy link
Member

When a nested calc is used for a property value like the following:
calc(var(--pf-c-form-control--PaddingBottom) - calc(var(--pf-c-form-control--focus--BorderBottomWidth) - var(--pf-c-form-control--BorderWidth)))

Cssnano removes the inner calc leading to incorrect evaluation. This is due to bugs in a cssnano calc plugin that is included in the default set of minification plugins. My current recommendation is that we avoid nested calcs like the plague until cssnano fixes their bug (even then, if somebody pulls the scss or compiles manually, they might still have this issue).

Cssnano bug: postcss/postcss-calc#64
Gatsby developers attempted to workaround this here and decided to wait for the above fix: gatsbyjs/gatsby#9879
gatsbyjs/gatsby#9858

This is included in the default cssnano set as can be seen here: https://cssnano.co/guides/optimisations/

@HZooly
Copy link

HZooly commented Feb 6, 2020

Hey @dgutride, did you managed to find a workaround for this?

@mcoker
Copy link
Contributor

mcoker commented Feb 27, 2020

@dgutride do you know if this was resolved upstream? I tested this and nested calc() functions look OK in our compiled CSS.

@stale
Copy link

stale bot commented Jul 29, 2020

This issue has been automatically marked as stale because it has not had activity in the last 60 days. It will be closed in 30 days if no further activity occurs.

@stale stale bot added the wontfix This will not be worked on label Jul 29, 2020
@stale
Copy link

stale bot commented Sep 27, 2020

This issue has been automatically marked as stale because it has not had activity in the last 60 days. It will be closed in 30 days if no further activity occurs.

@stale stale bot closed this as completed Nov 1, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

4 participants