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

[Feature request] CSS Nesting support #3781

Open
woody-li opened this issue Mar 31, 2023 · 3 comments
Open

[Feature request] CSS Nesting support #3781

woody-li opened this issue Mar 31, 2023 · 3 comments

Comments

@woody-li
Copy link

woody-li commented Mar 31, 2023

https://www.w3.org/TR/css-nesting-1/
https://caniuse.com/css-nesting/
CSS Nesting has implemented, Chrome 112 and Safari 16.5 will support it.
Does less has any implement schedule of it?
An option or other settings (e.g. browserlist)?

@thecodechef
Copy link

@woody-li its Chrome 112 not Chrome 102 that will support CSS Nesting

@matthew-dean
Copy link
Member

@woody-li The short answer is there hasn't been a long-term roadmap for Less in regards to CSS Nesting. In general, Less is in maintenance mode. The other tricky thing is that CSS Nesting is not a 1:1 map to Less / Sass nesting. Both Less and Sass basically append whatever string is after & to form a compound selector. CSS Nesting isn't like that. Each selector and combinator after & is a distinct match. In other words, consider this example:

.box {
  &-header {
    background: red;
  }
}

In Less / Sass, this will match an element like this:

<div class="box-header"></div>

However, with CSS Nesting, this will match an element like this:

<-header class="box"></-header>

Less could probably add a flag to prevent flattening 🤔 , hmm...

@SuperPat45
Copy link

SuperPat45 commented Apr 23, 2023

Having an option to allow compiling LESS nesting to CSS standard compatible nesting (by rewriting only incompatibles nesting) would be awesome as soon as Firefox will implement it.

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

4 participants