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

optimizeColors: rgba|hsla with opacity >=1.0 should change to rgb|hsl #1082

Closed
clshortfuse opened this issue Jul 30, 2019 · 0 comments · Fixed by #1083
Closed

optimizeColors: rgba|hsla with opacity >=1.0 should change to rgb|hsl #1082

clshortfuse opened this issue Jul 30, 2019 · 0 comments · Fixed by #1083

Comments

@clshortfuse
Copy link
Contributor

Environment

  • clean-css version - 4.2.1:
  • node.js version - 10.16.0:
  • operating system: Windows 10 / Ubuntu 18

Configuration options

var CleanCSS = require('clean-css');
new CleanCSS({
   level: 2
})

Input CSS

.a { color: rgba(255, 255, 255, 1); }
.b { color: hsla(0, 100%, 50%, 1); }
.c { color: RGB(255, 255, 255); }
.d { color: HSL(0, 100%, 50%); }

Actual output CSS

.a{color:rgba(255,255,255,1)}.b{color:hsla(0,100%,50%,1)}.c{color:RGB(255,255,255)}.d{color:HSL(0,100%,50%)}

Expected output CSS

.a{color:#fff}.b{color:red}.c{color:#fff}.d{color:red}

I also noticed that color parsing is case-sensitive when they shouldn't be. It's messing up some SCSS code I'm using. In SCSS, rgb() is an internal function so I use RGB() instead. clean-css doesn't pick it up. PR coming up.

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

Successfully merging a pull request may close this issue.

1 participant