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

Feature request: support at-rules @supports and @container #86

Open
meduzen opened this issue Aug 18, 2022 · 2 comments
Open

Feature request: support at-rules @supports and @container #86

meduzen opened this issue Aug 18, 2022 · 2 comments

Comments

@meduzen
Copy link

meduzen commented Aug 18, 2022

Hello here!

Aside from the #79 issue for which there’s already a PR (#80), there’s no support for @supports nor @container queries.

For example, this @supports rule:

@supports (top: max(0px)) {
  .btn {
    bottom: max(calc(var(--safe-bottom)), calc(var(--some-var, 10px) - 10px));
    left: max(calc(var(--safe-left)), calc(var(--some-var, 10px) - 10px));
  }
}

outputs the following CSS

@supports (top: max(0px)) {
.btn {
    bottom: max(calc(var(--safe-bottom)), calc(var(--some-var, 10px) - 0.625rem));
    left: max(calc(var(--safe-left)), calc(var(--some-var, 10px) - 0.625rem));
}

I haven’t tested container queries, but according to that part of the code, I assume only @media is currently supported.

postcss-pxtorem/index.js

Lines 175 to 178 in 1226490

if (opts.mediaQuery && atRule.name === "media") {
if (atRule.params.indexOf("px") === -1) return;
atRule.params = atRule.params.replace(pxRegex, pxReplace);
}

@hemengke1997
Copy link

maybe ouput should be:

@supports (top: max(0px)) {
.btn {
    bottom: max(calc(var(--safe-bottom)), calc(var(--some-var, 0.625rem) - 0.625rem));
    left: max(calc(var(--safe-left)), calc(var(--some-var, 0.625rem) - 0.625rem));
}

BTW, you could try https://github.com/hemengke1997/postcss-pxtorem. Because this repo does not seem to be maintained for a long time

@meduzen-immoweb
Copy link

Thanks @hemengke1997 for taking over with your fork. I’m trying it now and it looks promising. 🙏

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

3 participants