← Back to context

Comment by ffsm8

9 hours ago

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