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

mergeLonghand is not always a safe transformation #448

Closed
philipwalton opened this issue Mar 3, 2018 · 1 comment · Fixed by #486
Closed

mergeLonghand is not always a safe transformation #448

philipwalton opened this issue Mar 3, 2018 · 1 comment · Fixed by #486

Comments

@philipwalton
Copy link

The postcss-custom-properties plugin sets fallbacks for properties that use native CSS custom properties. Unfortunately, I noticed cssnano was stripping these fallbacks out, and I traced it back to the mergeLonghand plugin.

Here's an example of what postcss-custom-properties does that gets stripped by mergeLonghand:

:root {
  --gutter: 1em;
}

.component {
  padding: var(--gutter);
}

/* becomes */

:root {
  --gutter: 1em;
}

.component {
  padding: 1em;  
  padding: var(--gutter);
}

But since cssnano sees two padding declarations, it tries to combine them to a single, longhand version. However, when doing that the fallback is lost.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
Release 4.0
  
To Do
Development

Successfully merging a pull request may close this issue.

4 participants