Why this, why now

The problem

CSS had no way to reuse a named chunk of declarations.

Why the 2017 @apply was abandoned

Tab Atkins's first version put a ruleset inside a custom property and expanded it with @apply:

x-component { --heading-style: { color: var(--theme-color); }; }
.heading { @apply(--heading-style); }

This "mixed levels". A custom property doesn't care whether it holds a value or a ruleset, so var(--theme-color) was resolved early, on the element where the property was defined (say, .list), not on the element that used it. Then came more questions (who sees custom properties set inside the block? what does it mean for a ruleset to inherit?), and Tab withdrew it himself in "Why I Abandoned @apply".

The new design learns from that: a mixin is not an inherited value but a definition that rewrites the style sheet.

How it works

1. Define and apply

@mixin --button(--bg <color>: royalblue, --fg <color>: white) {
  background: var(--bg);
  color: var(--fg);
  padding: .5em 1em;
  &:hover { background: color-mix(in oklch, var(--bg), black 20%); }
}
.danger { @apply --button(crimson); }