If CSS can’t match or improve on the obvious syntax used by sass then they should not implement it.
All of these options are confusing. Nesting is not a requirement for CSS. Just let it go and if you want nesting use sass.
If CSS can’t match or improve on the obvious syntax used by sass then they should not implement it.
All of these options are confusing. Nesting is not a requirement for CSS. Just let it go and if you want nesting use sass.
Not a requirement because it’s not in the spec or because developers don’t need it? If the former, the proposal is to make it a requirement. After CSS grid, CSS nesting is probably the most requested feature of CSS for as long as I can remember for web devs. I only use sass these days for nesting and it would be nice if I didn’t need that extra dependency.
Same. I'm using plain CSS on my current project while using the test implementation of option 3, using PostCSS plugins.
BTW, there is a spec [1].
I agree CSS has come a long way. Nested CSS is the one thing I'm waiting for before I completely abandon preprocessors.
Think about the amount of characters wasted on having to write a whole separate rule to add a hover effect or something similar. Sure, better practices could usually make this unnecessary, but there's definitely valid situations for it. If you add up all the extra kb across millions of sites, and all the extra savings minifiers would be able to achieve with this syntax, I'd bet it starts to add up at a certain point
I was sad to see it left out of 2022-interop, but it's definitely the biggest feature I'm waiting for
My understanding is the features for Interop were chosen because there wasn't good interoperability between browsers for them.
With CSS Nesting, once the spec (and the syntax) is finalized, it's going to work the same in all browser engines; hopefully it'll go smoothly and we won't need CSS Nesting be part of Interop 2023.
So... 20 bytes or so? A whopping 20 megabytes per a million websites.
Seems like a very, very, very small optimization.
[1] In particular the significant space char difference between &. And & .
Component-centered design is very common so the styles for each component that would benefit from :hover may have its own variation on it, for the color differences if nothing else.
:hover is not the only interaction pseudo-class, :focus and :active can also be nested.
I decided to not use Sass on my latest project; feels like CSS is at the point where I didn't need it any more. CSS has come a long way.
Yes! The indented syntax is why I’ve stuck with Sass, Stylus and SugarSS for all these years for the same reasons you stated.
But… I decided it was worth going back to plain CSS due to CSS Nesting and to simply my tooling.
And this is the problem. For so long there was a technical limitation because parsing complexity, then there suddenly wasn’t a limitation anymore and the existing syntax wasn’t good enough anymore so we’re shooting the moon.
I agree, all of the options are confusing. The only seemingly viable option is close to Sass, but it should just be strict and stop introducing more ambiguity to the grammar which is already absurdly complex.
This is beyond comprehensible. I guess I can never let go of preprocessors.