Skip to content

Handle CSS Nesting Module selectors? #1945

@jmreid

Description

@jmreid

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)?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions