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

CSS media query range syntax not downleveled #3748

Open
Josh-Cena opened this issue May 3, 2024 · 0 comments
Open

CSS media query range syntax not downleveled #3748

Josh-Cena opened this issue May 3, 2024 · 0 comments
Labels

Comments

@Josh-Cena
Copy link

Josh-Cena commented May 3, 2024

Playground

.container {
  width: 100%;
}

@media (width > 768px) {
  .container {
    width: 50%;
  }
}

a {
  &:hover {
    color: red;
  }
}
import * as esbuild from "esbuild";

const result = await esbuild.build({
  entryPoints: ["styles.css"],
  bundle: true,
  outdir: "dist",
  target: "chrome70",
});
console.log(result);

Compiled output:

/* styles.css */
.container {
  width: 100%;
}
@media (width > 768px) {
  .container {
    width: 50%;
  }
}
a:hover {
  color: red;
}

Note that the nesting syntax is downleveled, but not the range syntax. Range syntax is only supported from Chrome 104. It should be possible to compile it to min-width: 769px, or otherwise throw an error.

@evanw evanw added the css label May 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants