Post

I'm not sure I was precise enough! I don't mean passing a function call, but the function itself, so it can be called later on using the name of the custom prop. Is it possible? I can't find anything about it in the spec.

Ah, I see. Custom Props compute before they inherit, so you'd end up with the result of the function that gets passed down to children. Passing just the name would not be possible, as a <function-token> is a name with the opening paren glued to it.

I can't wait to try this out. Indeed, this combination of media/container/style queries will be so powerful. We’ll be able to move even more code out of Javascript. I think registered properties and use of the extended attr function will be important in making robust solutions.

That's only a proposal right now, so it does not exist at all yet - not even on paper. 👉 I'd set my hopes on custom functions landing sooner, which might even suppress the schemed-value() idea as functions can provide the functionality.

With CSS adding more and more advanced features (which I like!), what tooling do we have available that ensures we dont write broken code? How do I get red squiggly lines when I mis-write "functon"? How do I fail the CI? Or when I refer to a variable that doesn't exist?

Our ecosystem has seen a massive move towards TypeScript-powered typesafety, and convincing the safety-purists that pure-CSS is the future is always going to be hard if mistakes aren't caught at compile-time.

Mixins are planned to be part of the same spec. First to get functions right, and then expand it to return a set of values.

UPDATE: Last Friday support for `@container` inside `@function` got added. bsky.app/profile/bram... Like I said: Game Changer. 🤯

Bramus@bram.us

Current Status: CSS Custom Functions + Nested Style Queries. DEMO: codepen.io/bramus/pen/x... (Also: eagerly awaiting inline if() – but that’s not ready for prime time yet)

It feels like private custom properties will be more and more relevant for scoping things and all, in particular with functions. I think we want private custom properties (soon)!