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

Handle CSS Nesting Module selectors? #1945

Closed
jmreid opened this issue Jan 18, 2022 · 3 comments
Closed

Handle CSS Nesting Module selectors? #1945

jmreid opened this issue Jan 18, 2022 · 3 comments

Comments

@jmreid
Copy link

jmreid commented Jan 18, 2022

It's still in draft, and not supported anywhere yet, but I'm wondering if esbuild should handle this code when minifiying:

.link {
    color: red;
    &:hover {
      color: blue;
    }
}
.another-class {
    color: yellow;
}

Right now, this outputs:

.link{color:red;&:hover{color:#00f}}.another-class{color:#ff0}

One day, this will be supported in browsers. But for now, we'd want to output this if our CSS target isn't set to the newest support:

.link{color:red}.link:hover{color:#00f}.another-class{color:#ff0}

Or even:

.link{color:red}.another-class{color:#ff0}

Or maybe minification should fail (similar to JS when your syntax cannot be minified to support your target)?

@evanw
Copy link
Owner

evanw commented Jan 20, 2022

I agree that it'd be nice if this was lowered. I'll add a warning for now but keep this issue open.

@evanw
Copy link
Owner

evanw commented Dec 28, 2022

Since this issue was posted, the specification authors have decided to go back and rethink the syntax, so this currently isn't actionable. The final syntax will likely be different than what esbuild implements.

I'm going to close this issue for now since it's not currently something esbuild can move forward with. We can move forward if/when the specification authors figure out what they want this feature to be.

@evanw evanw closed this as not planned Won't fix, can't repro, duplicate, stale Dec 28, 2022
@evanw evanw reopened this Feb 16, 2023
@evanw
Copy link
Owner

evanw commented Feb 16, 2023

It looks like this is shipping in nightly browser versions: https://webkit.org/blog/13813/try-css-nesting-today-in-safari-technology-preview/. The syntax could still change, but it is now more certain than it was before.

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