Re: [csswg-drafts] [css-properties-values-api] A compact syntax for registering global constants/custom properties (#9206)

> For example, a property with <length> syntax cannot have an initial value of 3em.

I think we probably already rely on initial values being in absolute/cononical-unit form, but assuming it's possible, it could be very bad for performance. In the worst case, it will be as if you specify all your "global" custom properties with `* { ... }` instead of `:root { ... }`. But I definitely see your point.

> Even without a syntax, variable cross-reference is not allowed

But maybe we can allow `env()`?

> If the "environment variable name" is dashed, it just looks up the initial value of the corresponding custom property, done.

That actually sounds very nice? And using `env()` makes it clear that it's a not an element-specific lookup.

> I'm not sure what you meant by this, @andruud.

> (I linked @custom-media above, and mentioned global variables could be used to achieve the same thing. I believe Anders was referring to that.)

Yeah, I meant that if you can substitute arbitrary stuff into `@media (...)` with `env()`, then probably `@custom-media` isn't needed. Nor is `@custom-container`, nor `@custom-future-thing`.

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


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

Received on Friday, 18 August 2023 11:56:52 UTC