Live data from Hacker News

WebKit Supports Nested CSS

webkit.org

11–20 of 183 posts

Re: WebKit Supports Nested CSS

#11

Will nested CSS support mixing properties and nested rules in any order, or do all the nested rules have to grouped together at the end? Right now, I frequently write SCSS rules like this: .some-class { background: blue; &:hover {background: red} border: 1px solid; &:active {border: 1px dashed} padding: 16px; display: flex; gap: 8px; & > * { color: red; } } And it would be a pity if that wasn't allowed. The reason I…

As I understand it, you can mix it but the parser will hoist all the immediate some-class styles to the top

Re: WebKit Supports Nested CSS

#12

Will nested CSS support mixing properties and nested rules in any order, or do all the nested rules have to grouped together at the end? Right now, I frequently write SCSS rules like this: .some-class { background: blue; &:hover {background: red} border: 1px solid; &:active {border: 1px dashed} padding: 16px; display: flex; gap: 8px; & > * { color: red; } } And it would be a pity if that wasn't allowed. The reason I…

Why would it not support it?

Re: WebKit Supports Nested CSS

#13
I don't know anything about WebKit development processes or community management, so please forgive me if I say something wrong.

Isn't it interesting how the engine has been implementing new features and generally running on a lot of steam coincidentally since the EU's Digital Markets Act (which will force other web engines on iOS) went into effect?

Or maybe the dev process and community interactions has always been like this, in which case disregard what I just said and feel free to correct me.

Re: WebKit Supports Nested CSS

#14

Is there a PostCSS or similar plugin which enforces this nesting syntax (& required for element selectors) so we can be ready for when this is widely adopted?

PostCSS has supported CSS nesting for many years now. The nesting standard has changed pretty minimally over the years and the PostCSS team has done an excellent job keeping up

One of the main reasons I never used CRA for my miniprojects was because the first thing I always wanted to do was set PostCSS up with nested CSS support which was a pain to do in CRA

Re: WebKit Supports Nested CSS

#15
Whenever I see nested CSS, I always think the non-nested version is cleaner.

Then again, I'm lucky enough to often work with my own 'hand-crafted', semantic html, and not some div soup generated by a tool.

Re: WebKit Supports Nested CSS

#17

    :is(article) &
That looks hacky at best.

The excuse of parsing performance is responsible for so much weird syntax in web standards today. The standards are literally being dragged around by browser vendors' priorities.

I wish they would do it the other way around for once: come up with the cleanest, easiest-for-humans syntax as possible, and tell browser vendors to fix their damn engines. Perhaps this will lead to the development of a new CSS engine that's actually optimized for the latest goodies.

Instead, for the last decade or so, we've only been getting bits and pieces of half-assed imitations of Sass. Better than nothing, of course, but still seriously lacking.

Re: WebKit Supports Nested CSS

#18

I don't know anything about WebKit development processes or community management, so please forgive me if I say something wrong. Isn't it interesting how the engine has been implementing new features and generally running on a lot of steam coincidentally since the EU's Digital Markets Act (which will force other web engines on iOS) went into effect? Or maybe the dev process and community interactions has always been…

Didn't it go into effect in September 2022?

Safari took a leading role in interop-2022[0] from the very start. So the change in Safari's philosophy stretches back at least to start of 2022, but they've also led the way on adoption of a number of other web standards like the new colorspaces which they've had since 2021 and which Edge and Firefox still don't support (well, FF has a feature flag)

[0] https://wpt.fyi/interop-2022

Re: WebKit Supports Nested CSS

#19
post #12

Will nested CSS support mixing properties and nested rules in any order, or do all the nested rules have to grouped together at the end? Right now, I frequently write SCSS rules like this: .some-class { background: blue; &:hover {background: red} border: 1px solid; &:active {border: 1px dashed} padding: 16px; display: flex; gap: 8px; & > * { color: red; } } And it would be a pity if that wasn't allowed. The reason I…

Why would it not support it?

I don't know, that's why I'm asking.
Post reply on HN