I believe the rationale against allowing custom properties was because custom properties are applied against elements, not at-rules that aren't attached to any element.
But now that we can nest at-rules inside selectors, shouldn't we then allow custom properties for nested at-rule conditions?
As for why we can't just use the proposed author env() variable, it's because we can't dynamically change it per element.
Example of a Flexbox component with dynamic breakpoint set via inline style (which is not possible with env()):
.flex {
display: flex;
container-type: inline-size;
--breakpoint: initial; /* reset */
}
.flex > * {
flex: 1;
@container (calc($(--breakpoint) < width)) {
flex-basis:100%;
}
}
<div class="flex" style="--breakpoint:640px">
<div>column</div>
<div>column</div>
</div>
I believe the rationale against allowing custom properties was because custom properties are applied against elements, not at-rules that aren't attached to any element.
But now that we can nest at-rules inside selectors, shouldn't we then allow custom properties for nested at-rule conditions?
As for why we can't just use the proposed author
env()variable, it's because we can't dynamically change it per element.Example of a Flexbox component with dynamic breakpoint set via inline style (which is not possible with
env()):