This is a super useful method. Most developers tend to use SCSS just like CSS but there are tons of possibilities in this extension of CSS.
Yesterday I decided to invest some time in refactoring my stylesheets to take advantage of this power. A common pattern that I developed involved the
Imagine that you need to display profits and losses. You have two classes for each group which are very similar except for the text color.
@extend allows you to abstract common attributes and focus on what’s unique about each class.
1 2 3 4 5 6 7 8 9 10 11 12 13
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
This helps a lot when prototyping UIs. I no longer need to jump around my stylesheet to update properties. I can simply modify the extended class in most cases.