Skip to content

Semicolons being added after & nesting rules postcss-nesting #1150

Closed
@AlbertMarashi

Description

@AlbertMarashi

Bug description

Semicolons being added after } blocks using css nesting, leading to invalid CSS (semicolons not valid after } block)

Source CSS

button {
    display: flex;
    border: 1px solid var(--dark);
    width: 100%;
    justify-content: center;
    height: 100%;
    align-items: center;
    gap: 8px;
    padding: 4px 8px;
    font-size: 14px;
    font-weight: 500;
    &.selected {
        background: rgba(var(--brand-rgb), 0.1);
    }
    &:first-child {
        border-radius: 50px 0 0 50px;
    }
    &:last-child {
        border-radius: 0 50px 50px 0;
    }
}

Expected CSS

button.s-gwue9lYI_bHl{display:flex;border:1px solid var(--dark);width:100%;justify-content:center;height:100%;align-items:center;gap:8px;padding:4px 8px;font-size:14px;font-weight:500;}button.s-gwue9lYI_bHl.selected {
        background: rgba(var(--brand-rgb), 0.1);
    }button.s-gwue9lYI_bHl:first-child {
        border-radius: 50px 0 0 50px;
    }button.s-gwue9lYI_bHl:last-child {
        border-radius: 0 50px 50px 0;
    }.s-gwue9lYI_bHl{}

Actual CSS

button.s-gwue9lYI_bHl{display:flex;border:1px solid var(--dark);width:100%;justify-content:center;height:100%;align-items:center;gap:8px;padding:4px 8px;font-size:14px;font-weight:500;}button.s-gwue9lYI_bHl.selected {
        background: rgba(var(--brand-rgb), 0.1);
    };button.s-gwue9lYI_bHl:first-child {
        border-radius: 50px 0 0 50px;
    };button.s-gwue9lYI_bHl:last-child {
        border-radius: 0 50px 50px 0;
    }.s-gwue9lYI_bHl{}

Does it happen with npx @csstools/csstools-cli <plugin-name> minimal-example.css?

  • no

Debug output

No response

Extra config

Using SvelteKit, Vite

What plugin are you experiencing this issue on?

PostCSS Nesting

Plugin version

^12.0.1

What OS are you experiencing this on?

Windows

Node Version

18.17

Validations

  • Follow our Code of Conduct
  • Check that there isn't already an issue that request the same feature to avoid creating a duplicate.

Would you like to open a PR for this bug?

  • I'm willing to open a PR

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions