Skip to content

postcss-nesting not generating with ::ng-deep nested nodes #1609

Not planned
@kstrasters-pj

Description

@kstrasters-pj

Bug description

With the 13.0.0 update, the Angular ::ng-deep selector no longer is nestable

i.e.

::ng-deep {
  .some-class {
  }
}

the above used to work, but the only way i've gotten it to work since 13.0.0 is to not nest

::ng-deep .some-class {
}

the work around isn't that terrible, but is it annoying that the nesting plugin is forcing me to avoid nesting in certain situations.

Source CSS

::ng-deep {
.some-class {
}
}

Expected CSS

::ng-deep {
.some-class {
}
}

Actual CSS

doesn't appear to be outputted at all anymore

Playgound example

No response

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

None

Debug output

No response

Extra config

No response

What plugin are you experiencing this issue on?

No response

Plugin version

13.0.0

What OS are you experiencing this on?

macOS

Node Version

22.12.0

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

Activity

changed the title [-]postcss-nesting[/-] [+]postcss-nesting not generating with ::ng-deep nested nodes[/+] on May 12, 2025
romainmenke

romainmenke commented on May 12, 2025

@romainmenke
Member

::ng-deep is not a standard selector.
postcss-nesting only supports standard CSS.

This is not something we can fix or help you with.

I also don't know anything about Angular so I can't really give any guidance.

kstrasters-pj

kstrasters-pj commented on May 12, 2025

@kstrasters-pj
Author

I understand it's non standard, but it was working prior to this update, i figured y'all might be interested in knowing that.

I have tested this with Angular css native and it works jsut fine as well. So it is specifically related to the package update, or one of the downstream updates.

Feel free to mark as won't-fix or something, but was jsut trying to provide some information, or a place for someone else to find down the road

romainmenke

romainmenke commented on May 12, 2025

@romainmenke
Member

Yeah, anything non-standard like this ::ng-deep selector is always at risk of breakage.
In this case it is communicating that it is a pseudo element by having a double ::.

Pseudo element selectors can't be used with CSS nesting.

This won't work either:

::before {
  & {
  }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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

        Participants

        @romainmenke@kstrasters-pj

        Issue actions

          postcss-nesting not generating with ::ng-deep nested nodes · Issue #1609 · csstools/postcss-plugins