Re: [csswg-drafts] [css-nesting-1] Should code portability trump coding habits wrt nesting syntax? (#8029)

> You can take the CSS code, prepend :where(article.legacy) {} {, indent the entire list of rules, then close the brace with }.

Thank you for elaborating, I know understand what the statement intended :)

> This operation is error-prone and takes time, for something which I expect to be a very common refactoring.

I find it difficult to weight these correctly.
From my perspective this is a very uncommon case.

Much more common to have existing blocks and add something nested inside of it.
The outermost element of a component rarely changes.
Adding or removing extra bits inside seems to happen much more frequently.

-----

> Plus, now, if you want to go back to an independant stylesheet (because, say, you moved to web components and isolated the legacy content there), you have to go back and remove all the & symbols since they don't mean anything anymore. If you had used proposal 4 or 5, you would not need to do this.

There are proposals to give `&` meaning everywhere and to allow relative selectors everywhere.

- https://github.com/w3c/csswg-drafts/issues/5745
- https://github.com/w3c/csswg-drafts/issues/8010

Not saying that that is a reason not to pick 4 or 5.
But it is something that isn't made impossible simply by choosing 3.

------

> I would also like to point out that with autocompletion these days, you hardly ever write a } yourself. They are auto-inserted. The actual workflow when adding nested rules is more likely to be "click after the } and type { then your rules".

Ah, yes, I forget about that because I disable this behavior.

> A smart IDE could unemphasize these two braces with a different (less-contrasting) coloring,

Could even be a ligature like we have for `!==`

<img width="67" alt="Screenshot 2022-12-05 at 12 05 33" src="https://user-images.githubusercontent.com/11521496/205622291-5ed5b9b2-a4cd-41f7-b187-edb140da7b36.png">


-- 
GitHub Notification of comment by romainmenke
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/8029#issuecomment-1337147063 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Monday, 5 December 2022 11:06:35 UTC