Re: [csswg-drafts] [css-mixins-1] Should we be more explicit about the result? (@result) (#13138)

@Crissov In this issue, there is one _main_ question I would like to resolve, and two _follow-up_ questions:

1. Main question: Do we want to mark the _result_ of a mixin explicitly instead of marking _locals_ explicitly?

In my opinion, we do, since explicitly marking locals adds a lot of "@-noise" in anything but trivial examples, it matches how CSS Functions work, and reduces the chance of unintentionally leaking locals onto elements. My proposed resolution is that the result is described by `@result { /* contents */ }`, making stuff outside of the `@result` rule local/internal mixin logic.

2. Follow-up: Does a `@result` rule replace a previous rule, or are they additive?

This depends on whether you think of `@result` as something which sets a single thing (a "result"), or whether you think of it as basically `"@public"`.

It seems reasonable to match `@function` as much as possible, and let `@result` _replace_ the previous rule.

3. Follow-up: Is `@result` implicit if omitted?

We could optionally decide that a mixin which does not contain any `@result` rules implicitly wrap their contents in a `@result` rule, to reduce the noise of smaller mixins.

I'd slightly prefer to make `@result` _required_, but I'm also OK with the alternative.

---

>  body of the @mixin {} at-rule block

_Outside_ of `@result`, you can use whatever is valid in `@function`, _minus_ the `result` descriptor, _plus_ the `@result` rule.

_Inside_ of `@result`, it's whatever we already decided goes in a mixin: anything, minus `@layer` (per resolution elsewhere), minus `@mixin`, plus `@apply`, plus `@contents`? 

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


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

Received on Wednesday, 21 January 2026 14:27:38 UTC