Live data from Hacker News

WebKit Supports Nested CSS

webkit.org

81–90 of 183 posts

Re: WebKit Supports Nested CSS

#81

Maybe I am an outlier... but I really don't like nested style documents like those founds with SASS, LESS, PostCSS. When the number of nested selectors becomes too great it can become very difficult to reason about. I would never use this without some kind of lint rule enforcing a maximum depth of selector nesting. I agree with the other commenters ITT taking the position flat CSS looks cleaner than nested documents.

> When the number of nested selectors becomes too great it can become very difficult to reason about. This is a sign you need to decompose whatever design you are working on into smaller components. If you’re trying to write styles for a whole page at once, you’ll see this problem, but if you are working on small components, it’s very rare.

> decompose whatever design you are working on into smaller components

I haven't followed modern CSS development much. Does it have a module system now?

Re: WebKit Supports Nested CSS

#83
post #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 t…

I agree it's a big mistake to not make the nesting rules compatible to Sass/Less. > Because of limitations in browser parsing engines, you must make sure the nested selector (.bar in the above example) always starts with a symbol. How hard can it be.. I know that is always easy to say from the outside but in this case I don't understand why the refuse to implement it. Just labelling it as a performance problem doesn'…

Iirc, this requires unbounded lookahead.

Imagine a CPU that is fast but has no concept of stack, so no recursion/callstack for you. You can simulate it through registers, but only as much as register pressure allows in a finite register file. Allowing unbounded call stack requires changing the class of a CPU to the one that has stack (and is slower, due to analogy is incomplete).

In the same way, &-less grammar changes the class of a parser required to parse it. You can’t simply adjust the existing one. In the end it all boils down to the amount of dynamic allocations and backtracking required for parsing the same megabyte of css.

Edit: nothing substantial was said about actual numbers, at least from what I’ve read. It’s a common sense that seems nobody has tested (in this particular case).

Re: WebKit Supports Nested CSS

#84

man I can't wait to not need LESS/SCSS anymore. the less I need to compile/transpile before handing stuff off to the browser, the better in my book.

I don't understand this viewpoint, but I've seen it a lot so you're definitely not alone. A large part of what's useful about SASS are the mixins and functions, not just nesting - do you just not use those?

Re: WebKit Supports Nested CSS

#86

Earlier quoted context omitted.

If syntactic sugar was really just sugar, JS would have sticked to callback functions, and we’d still be inventing abstractions to make our lives easier. Syntactic sugar, sometimes, is the promise of sunnier mornings and that matters.

"For a Linux user, you can already build such a system yourself quite trivially by getting an FTP account, mounting it locally with curlftpfs, and then using SVN or CVS on the mounted filesystem. From Windows or Mac, this FTP account could be accessed through built-in software."

Solid reference

Re: WebKit Supports Nested CSS

#88

Sanity has prevailed! Great work from the WebKit team, leading the way here. Not to mention great solve on the `color: blue` fiasco. Balances an edge-case compromise nicely, and leaves it open to future improvements. Bravo.

What is the `color: blue` fiasco?

Re: WebKit Supports Nested CSS

#89
It's great it's here, but isn't everyone and their dog who wants features like this using PostCSS, LESS or SASS? In a build environment that nearly makes this transparent.

I use Vite and PostCSS and a bevy of linters, image processing tools, even for CSS-only projects because they're so fast and generally so good at what they do that it'd be silly not to. I used to hodge tools together with Makefiles but Vite in particular has made the setup for all this stupid-simple.

I make changes, 100ms later Vite deposits a new, optimised build into my Django static dir.

Re: WebKit Supports Nested CSS

#90

https://caniuse.com/css-nesting So it's the latest chrome, Safari technical preview, and edge behind a flag. No disposition from Firefox yet afaict.

Mozilla has come out on support of the standard but I'm not seeing much on the Bugzilla tracker. May be a while until it's supported, especially since modifications like these also impact functionality like the syntax highlighter and the dev tools.
Post reply on HN