Re: [csswg-drafts] [css-mixins-2] bring back `@result` and make `@private` more intuitive and generally useful? (#14432)

see: https://github.com/w3c/csswg-drafts/issues/14442

-----

Can we make `private` a flag on custom property registration?

i.e. `@property --length <length> private: 1em;`

```css
/* lexically scoped to a stylesheet */
@property --length <length> private: 1em;

/* lexically scoped to a style rule */
.foo {
 @property --length <length> private: 1em;
}

/* lexically scoped to a mixin */
@mixin --foo(--color <color>: red) {
 @property --length <length> private: 1em;
 box-shadow: var(--color) var(--length);
}

/* 
   functions don't have the exact same issues around potential naming conflicts,
   but maybe private is also useful there?
*/
@function --foo(--color <color>: red) {
 @property --length <length>: 1em;
 @property --something <length> private: 1em;
 result: var(--color) var(--length);
}
```

----

I think that the friction/resistance I experience around the current `@private` rule can be boiled down to:
- it combines two distinct actions: value assignment and marking as private
- marking as private has to be done in a separate rule and this rule is not the lexical scope

Being able to register a private prop directly in the rule that is the lexical scope would be a much more intuitive syntax.

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


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

Received on Friday, 4 September 2026 06:43:12 UTC