CSS from the Future

Avatar of Robin Rendle
Robin Rendle on (Updated on )

Grow sales with a smart marketing platform. Try Mailchimp today Mailchimp tracking pixel

Zeke Sikelianos:

So. We have variables in CSS now. That’s pretty neat, but it doesn’t get us all the way to CSS heaven. What we really need is a way to write little bits of reusable CSS. These features have long existed in Sass, Less, and Stylus, but there’s no way to do it in regular CSS.

There’s plans for adding a new spec for what’s currently being called the @apply rule. It looks like a Sass mixin, but it’s really more like extending a placeholder selector, but because it’s native, without the selector insanity that extend can cause.

Blink is already shipping it behind a runtime flag.

Update: Tab Atkins says @apply is abandoneded, and might end up being something more like ::part() and specifically for Shadow DOM.

There’s plenty more space to experiment here, and while it does suck to lose a tool that you might have gotten excited about, @apply really is just quite a bad idea technically. Let’s solve these problems correctly.

Direct Link →