Answer the question
In order to leave comments, you need to log in
Include or extend in Sass?
So I can not figure out which is preferable and in what situations? Tell me from your experience. Thanks
Answer the question
In order to leave comments, you need to log in
In my opinion include. The abundance of extends litters the selectors.
Think of it like this - extend creates relationships between selectors. Consider whether you need to link h1 and button to make them bold or green? I think no.
but extend for general styles of the same single button can be useful. Although, if you need a mixin for the buttons (and you most likely will, because you will need to pass parameters), then use a mixin. Also extend can be useful in headers and the like.
Many people don’t like Extend because if you have more than one nesting level + you write several selectors (separated by commas), then the result in the collected CSS can be the most unexpected ...
In all other cases, it makes more sense to use a mixin.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question