Re: [csswg-drafts] [css-scoping] Scoping of functions, other name-defining at-rules and custom idents (#11798)

I've been hoping for some sort of name scoping for a while but I'd rather have lexical scoping where a name is local to a file or block of CSS code, rather than certain parts of the document.

In its most basic form, this could be implemented by just prefixing any names found within a scope:

```css
@layer has-local-name {
   @local --color; /* scoped to the layer */

   /* gets turned into --internal-prefix-color */
   :root { color: var(--color) }
}
:root {
   --color: red; /* does nothing because plain `--color` isn't used anywhere */
}
```

A neat side effect here is that this could be done entirely by a preprocessor so it could be used in production a lot sooner.

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


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

Received on Monday, 3 March 2025 19:28:19 UTC