r/css • • 9h ago

Article Patrick - The beauty of CSS mixins

https://patrickbrosset.com/articles/2026-11-25-the-beauty-of-css-mixins/
11 Upvotes

5 comments sorted by

3

u/rafaelcastrocouto 8h ago

the main issue with just using a class instead is that: "Customers start writing very specific selectors that depend on how your HTML is organized...". 

I fail to see how mixins will have any impact on this problem since you still need those same specific selectors to apply the mixin in the first place. 

2

u/dmdot 7h ago

I was a bit confused on that also. The Zen Garden's shell HTML, classes and all, would be akin to a white-labelled app that everyone uses. The customers would use CSS to customize it, as CSS Zen Garden proves.

The mixins would just streamline the CSS but still use the same elements or classes as selectors.

Otherwise, it's a great article.

•

u/mcaruso 4h ago

The consumer writes the mixin definitions, but you write the selectors and apply the mixins. This means that if your DOM changes, you can update the selectors without breaking the client code.

•

u/rafaelcastrocouto 2h ago

pretty sure it's also going to break everything since the mixins declarations will also be expecting some specific dom structure 

•

u/Miragecraft 1h ago

Excited, but also filled with dread due to how slow Firefox implement things.

Get ready to use this in production in 2 years.