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

Closed
jjwwiodyne opened this issue Nov 6, 2020 · 5 comments
Closed

[Bug] : opacity percentages remove zeroes #962

jjwwiodyne opened this issue Nov 6, 2020 · 5 comments
Labels
Milestone

Comments

@jjwwiodyne
Copy link

@jjwwiodyne jjwwiodyne commented Nov 6, 2020

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%; }
}

Becomes:

@-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: https://cssnano.co/playground
  2. Add the CSS above.
  3. Click Run.

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

@anikethsaha
Copy link
Member

@anikethsaha anikethsaha commented Dec 4, 2020

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

@bdoodo
Copy link

@bdoodo bdoodo commented Jan 24, 2021

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

@anikethsaha
Copy link
Member

@anikethsaha anikethsaha commented Jan 24, 2021

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

@alexbrault
Copy link

@alexbrault alexbrault commented Feb 1, 2021

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
@ludofischer
Copy link
Collaborator

@ludofischer ludofischer commented Mar 19, 2021

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
Labels
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
5 participants