For example, are @mixin rules valid within @container?
@container (...) {
@mixin --m() {
/* style rules */
}
}
If yes, we already know that --m() isn't defined conditionally based on CQ evaluation (https://drafts.csswg.org/css-conditional-5/#container-rule, last paragraph of chapter), but are the inner style rules affected?
In other words, does the above @apply rule "remember" that the referenced mixin is enclosed by an @container? Any decision we make should hopefully answer the same question about @layer, @starting-style, etc.
My initial thought is that (for simplicity) we should make @mixin invalid within any at-rule except conditional rules with the "old school" processing model (i.e. currently @media and @supports).
For example, are
@mixinrules valid within@container?If yes, we already know that
--m()isn't defined conditionally based on CQ evaluation (https://drafts.csswg.org/css-conditional-5/#container-rule, last paragraph of chapter), but are the inner style rules affected?In other words, does the above
@applyrule "remember" that the referenced mixin is enclosed by an@container? Any decision we make should hopefully answer the same question about@layer,@starting-style, etc.My initial thought is that (for simplicity) we should make
@mixininvalid within any at-rule except conditional rules with the "old school" processing model (i.e. currently@mediaand@supports).The CSS Working Group just discussed
[css-mixins-1] Are @mixin rules valid within other at-rules?, and agreed to the following:RESOLVED: @layer is invalid inside mixins (for level 1)RESOLVED: Mixins have to be defined before useRESOLVED: Custom media queries need to be defined before useRESOLVED: @mixin is valid wherever @keyframes is validSUMMARY: Still open question of whether @mixin declarations are layered -- either way is acceptable implementation-wiseACTION: TabAtkins to file issue on whether global name-defining things should be invalid inside contextual conditionsl such as @container or @scopeThe full IRC log of that discussion
<fantasai> andruud: Question of @mixin withi…