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

Don't always convert dppx unit to x unit in resolution media queries #229

Closed
yisibl opened this issue Jul 16, 2022 · 1 comment
Closed

Comments

@yisibl
Copy link
Contributor

yisibl commented Jul 16, 2022

css-values-4 adds x as an alias for dppx unit, but not every browser in media queries supports x unit. So I think it would be better to add a fallback for x unit.

x unit support in: Chrome 68+, Edge 79+, Opera 55+, Safari 16+, Firefox 62+

Input

@media (resolution: 1dppx) { /* or resolution: 1x */
    body {
       background: red;
    }
}

Output

@media (resolution: 1x) {
    body {
       background: red;
    }
}

Expected

@media (resolution: 1dppx), (resolution: 1x) {
    body {
       background: red;
    }
}

Minify

When compressing, if the configured browser version does not support x unit, only dppx will be retained.

@media (resolution: 1dppx) {
    body {
       background: red;
    }
}

See also: postcss/autoprefixer#1468

@devongovett
Copy link
Member

One place where this doesn't apply is image-set(), where 1x/2x etc. are supported much earlier than other resolutions.

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

No branches or pull requests

2 participants