Comment by tr45872267

6 hours ago

Because modern UI toolkits like Flutter proved that UI should just be code, not separated into three different languages. In this case, adding conditionals can remove the need for js in some cases, which is good.

Considering how this is seems to be designed... I don't think that's the reason?

I mean looking at the mdn docs it's just a replacement for regular other syntax https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/V...

So instead of having a css for x which defines e.g. dark mode and light mode separately, you can now define it via a single css rule.

Where previously the "tree" forked at the beginning and attributes were set multiple times, depending on various criteria - now you set it once, and evaluate it's value depending on criteria

    div {
      background-image: if(
        style(--scheme: ice): linear-gradient(#caf0f8, white, #caf0f8);
        style(--scheme: fire): linear-gradient(#ffc971, white, #ffc971);
        else: none;
      );
    }

It looks like simple syntactic sugar to me