| 33 | Understanding the Dangers of @extend |
@extend is certainly powerful, but it can cause bloated output styles if not used carefully.
The example illustrates how just a couple of @extend uses can quickly spiral into some bloated output. All that’s happening is that the .small-icon class is extended onto two other areas. However, where it’s being extended is a little messy. There’s a couple of nested selectors, and they use commas. So Sass has to add all of those class permutations onto the original class, which leaves us with the bloated output you see.
This example shouldn’t suggest that you should never use @extend. Instead, it should illustrate that when choosing between a mixin or extend, you need to think about how you might be using it. ...