B
B
Breeze12017-07-31 19:29:06
css
Breeze1, 2017-07-31 19:29:06

SASS: extend or mixin?

Please help a newbie clear up a few things with SASS. When should mixins be used? For example, I have a frequently repeated code:
.item
display: flex
justify-content: center
flex-wrap: wrap
It seems to me that instead of a mixin it would be more appropriate to make an extension, like this:
%item
display: flex
justify-content: center
flex- wrap: wrap
.container
@extend %item
We don't repeat the same code over and over, we group selectors and write the same rules for them. So in what cases then it is worth using mixins? Thanks

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Sergey delphinpro, 2017-07-31
@Breeze1

There is no need to divide the world into black and white. It has many more shades.

A
andead, 2017-07-31
@andead

extend cannot be used in @media, so I only use mixins.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question