Re: [csswg-drafts] [css-mixins-1] Are @mixin rules valid within other at-rules? (#12417)

> This all gets a lot simpler if we just don't allow `@mixin` to be used inside of `@layer`, fwiw. Then we can say that mixins are substituted before layers are applied, then whatever you get post-resolution has the normal layer effects.

Or that `@mixin` always behaves as if it was not layered, even when layered.

Thinking of:
- importing a framework/library with a layer condition in the `@import` prelude where that framework contains a mix of styles and mixins.
- organizing own styles in `base`, `component`, ... layers (this pattern is now mentioned a lot) and in each file importing the shared mixins.

I think that cascade layers are a much more needed/useful tool for style rules and less so to avoid naming conflicts. Even when layers can be used to some effect to resolve conflicts, you rarely want one to win over the other.

e.g. everyone named their mixin `--button` and now there are conflicts.

So I think I am fine with `@mixins` always behaving as if they were unlayered.

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


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

Received on Wednesday, 16 July 2025 06:16:57 UTC