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

clean-css 5.0.1 leading zeros are not removed #1143

Closed
XhmikosR opened this issue Feb 11, 2021 · 10 comments · Fixed by davidrapson/davidrapson.co.uk#92
Closed

clean-css 5.0.1 leading zeros are not removed #1143

XhmikosR opened this issue Feb 11, 2021 · 10 comments · Fixed by davidrapson/davidrapson.co.uk#92
Labels

Comments

@XhmikosR
Copy link
Contributor

XhmikosR commented Feb 11, 2021

Precheck

Environment

  • clean-css version - npm ls clean-css: 5.0.1
  • node.js version - node -v: 14.15.5
  • operating system: Windows 10

Configuration options

cleancss -O1 specialComments:0 -o 2.css 1.css

Input CSS

kbd {
  padding: 0.2rem 0.4rem;
  font-size: 0.875em;
  color: #fff;
  background-color: #212529;
  border-radius: 0.2rem;
}

Actual output CSS

kbd{padding:.2rem .4rem;font-size:.875em;color:#fff;background-color:#212529;border-radius:0.2rem}

Expected output CSS

kbd{padding:.2rem .4rem;font-size:.875em;color:#fff;background-color:#212529;border-radius:.2rem}

I noticed more cases, not only border-radius and it seems to only happen for rems.

@jakubpawlowicz
Copy link
Collaborator

Hey @XhmikosR - by saying "I noticed more cases" do you mean more cases of border-radius or other properties too?

@XhmikosR
Copy link
Contributor Author

I meant more CSS properties. It's like it's unrelated to the CSS property but specific to rem.

You can try the branch if you want to check the diff https://github.com/twbs/bootstrap/tree/main-xmr-update-cleancss

@XhmikosR
Copy link
Contributor Author

FYI this is the size diff compared to clean-css v4.

@jakubpawlowicz
Copy link
Collaborator

Thanks, I'll have a look and fix it.

@jakubpawlowicz
Copy link
Collaborator

^ this should do the trick, please have a quick look at b8c2657#diff-ec858cb5d55ea11dd5f18cb15cfd49435b1bb3cfb1833eee78398b17ac0dd527 if it looks ok to you.

@XhmikosR
Copy link
Contributor Author

Thanks for taking a look, I really appreciate it!

https://ja2r7.app.goo.gl/cVvQAgjcNbovnGNZ7

It seems there are more cases, like this one:

.progress-bar-striped {
  background-image: linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);
  background-size: 1rem 1rem;
}

0.15 isn't converted to .15.

I'd just check out my upstream branch and as long as the output is the same, then we should be good to go :)

@jakubpawlowicz
Copy link
Collaborator

@XhmikosR I get the same output now. I'm gonna merge it and release it.

@XhmikosR
Copy link
Contributor Author

@XhmikosR
Copy link
Contributor Author

I tried our v4-dev branch too and seems to be fine too:

@jakubpawlowicz
Copy link
Collaborator

It's out as clean-css 5.1.0 and clean-css-cli 5.2.0. Thanks for testing!

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