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

[Bug] : opacity percentages remove zeroes #962

jjwwiodyne opened this issue Nov 6, 2020 · 5 comments

[Bug] : opacity percentages remove zeroes #962

jjwwiodyne opened this issue Nov 6, 2020 · 5 comments


Copy link

Describe the bug
100% is transformed to 1% for opacity properties:

@-webkit-keyframes fade {
    0% { opacity: 100%; }
   40% { opacity: 0%; }
   60% { opacity: 0%; }
  100% { opacity: 100%; }


@-webkit-keyframes fade{0%{opacity:1%}40%{opacity:0}60%{opacity:0}to{opacity:1%}}

To Reproduce
Steps to reproduce the behavior:

  1. Go to the cssnano playground:
  2. Add the CSS above.
  3. Click Run.

Expected behavior
@-webkit-keyframes fade{0%{opacity:100%}40%{opacity:0}60%{opacity:0}to{opacity:100%}}

Copy link

sorry for the delay
Can you try this with cssnano@nightly if the issue still exists ?

Copy link

bdoodo commented Jan 24, 2021

@anikethsaha Is there a way to set up cssnano@nightly on a parcel configuration? Using your minifier with Parcel.

Copy link

Not really familiar with parcel's config. But you would use nightly same as you use cssnano.

Copy link

Bug title is slightly misleading; the code doesn't remove zeroes, it's just overly eager to clamp the opacity between 0 and 1 and doesn't take into account percentages. Since most non-zero percentages will be over 1, the clampOpacity function clamps it to 1, then adds back the percentage

@ludofischer ludofischer added this to the 5.0.0 milestone Mar 19, 2021
Copy link

Fixed in 5.0.0-rc.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet

No branches or pull requests

5 participants