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

fix: if the browser doesn't support #rrggbbaa color syntax, it is converted to transparent #296

Merged

Conversation

yisibl
Copy link
Contributor

@yisibl yisibl commented Sep 17, 2022

Currently only enabled when minify: true.

let opts = {
  minify: true,
  targets: {
    chrome: 61 << 16,
  }
}

Input

.foo {
  background-color: transparent;
  color: rgba(0, 0, 0, 0);
  border-color: rgb(0 0 0 / 0%);
  background: linear-gradient(90deg, rgba(0, 0, 0, 0), transparent);
}

Before

.foo{color:rgba(0,0,0,0);background:linear-gradient(90deg,rgba(0,0,0,0),rgba(0,0,0,0));border-color:rgba(0,0,0,0)}

After

This is consistent with cssnano.

.foo{color:transparent;background:linear-gradient(90deg,transparent,transparent);border-color:transparent}

@devongovett devongovett merged commit 1e7d0f9 into parcel-bundler:master Sep 17, 2022
@@ -370,24 +370,30 @@ impl ToCss for CssColor {
// If the #rrggbbaa syntax is not supported by the browser targets, output rgba()
if let Some(targets) = dest.targets {
if !Feature::CssRrggbbaa.is_compatible(targets) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@devongovett Maybe it would be better to convert only when dest.minify = true here too? I don't really like the parser conversion format if the CSS is not compressed. What do you think?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure

@yisibl yisibl deleted the minify-transparent-keyword branch September 18, 2022 03:46
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 this pull request may close these issues.

None yet

2 participants