Re: [csswg-drafts] [css-values-5] What is the MVP for inline conditionals on custom properties? (#10064)

The downside of the publicity this issue got is many people are parachuting into it and confidently asserting they can solve all the problems without being aware of the numerous constraints we need to navigate for something like this to even be possible. ๐Ÿ˜•

@mindplay-dk  Believe me, weโ€™d all LOVE to do `@if` and do it properly, and [me more than anyone](https://github.com/w3c/csswg-drafts/issues/5624). However, there are currently technical constraints that prevent us from doing so, namely that we donโ€™t want a rule that would have different behavior on descendants (like style queries) and different on the element itself (IACVT). Perhaps in the future it may become possible, if we implement something like #10443 to make IACVT behave as similarly to the regular cascade as possible.

> for example, maybe we specify a simple two-phase evaluation, such that:
> 
> 1. CSS properties are updated in the first phase, and
> 2. custom properties are updated in a second phase.

These are not independent, custom properties can depend on certain CSS properties, and CSS properties often depend on custom properties. Also, youโ€™re proposing a very major change to how CSS is evaluated, and major changes require major benefit to be justifiable, otherwise they stand no chance of implementation.

> I understand there is a potential for creating cycles with a feature like this, but... developers should know not to do that. ๐Ÿ˜…

Yeah, "users should just not do that" is not how you design a language (or any UI really).

> Wouldn't it make more sense to take cues from established and popular languages such as SASS, where conditionals are structural concepts? 

Even when languages have block conditionals, they ALL also have some kind of inline conditional, because there are just so many use cases where only a small part of a value actually varies, and a block conditional would actually make code _less_ readable. Yes, [even Sass](https://sass-lang.com/documentation/modules/#if). ๐Ÿ™‚

> CSS is really all about thinking and designing in terms of structure.

Is it now? ๐Ÿ˜…

-- 
GitHub Notification of comment by LeaVerou
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/10064#issuecomment-2245012159 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Tuesday, 23 July 2024 11:44:20 UTC