Skip to content

Large, Unnecessary Duplication of @supports Statements #825

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

Closed
2 of 3 tasks
dwighthouse opened this issue Feb 1, 2023 · 2 comments · Fixed by #826
Closed
2 of 3 tasks

Large, Unnecessary Duplication of @supports Statements #825

dwighthouse opened this issue Feb 1, 2023 · 2 comments · Fixed by #826

Comments

@dwighthouse
Copy link

Bug description

When specifying a series of things that generate @supports statements as part of their compatibility, identical, adjacent @supports statements will be meaninglessly generated individually where they should be combined, at least in cases where they are adjacent. Additional analysis could probably support the combining of similar statements that are not adjacent.

I have encountered the behavior in my project. The behavior is easily viewable in the interactive playground as well.

Source CSS

:root {
  --color1: oklch(52% 0.21 270);
  --color2: oklch(45% 0.21 270);
}

Expected CSS

:root {
    --color1: rgb(62, 85, 223);
    --color2: rgb(46, 62, 199);
}

@supports (color: color(display-p3 0 0 0)) {
    :root {
        --color1: color(display-p3 0.26256 0.33170 0.84336);
        --color2: color(display-p3 0.19377 0.23995 0.75043);
    }
}

Actual CSS

:root {
    --color1: rgb(62, 85, 223);
    --color2: rgb(46, 62, 199);
}

@supports (color: color(display-p3 0 0 0)) {
    :root {
        --color1: color(display-p3 0.26256 0.33170 0.84336);
    }
}

@supports (color: color(display-p3 0 0 0)) {
    :root {
        --color2: color(display-p3 0.19377 0.23995 0.75043);
    }
}

Does it happen with npx @csstools/csstools-cli <plugin-name> minimal-example.css?

N/A

Debug output

I do not know how to do this. The debug explainer link leads to out-of-date documentation.

Extra config

No response

What plugin are you experiencing this issue on?

PostCSS Env Function

Plugin version

8.0.1

What OS are you experiencing this on?

macOS

Node Version

17.0.1

Validations

  • Follow our Code of Conduct
  • Check that there isn't already an issue that request the same feature to avoid creating a duplicate.

Would you like to open a PR for this bug?

  • I'm willing to open a PR
@dwighthouse
Copy link
Author

Wow! Thanks for looking at this so quickly!

@romainmenke
Copy link
Member

Always happy to help!

I forgot to post an update here after the release, luckily you spotted it :)

@romainmenke romainmenke changed the title Large, Unnecessary Duplication of @supports Statements Large, Unnecessary Duplication of @supports Statements Feb 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants