Skip to content

Mixin or Extend #40899

Answered by ynng3
MohamadSalman11 asked this question in Q&A
Discussion options

You must be logged in to vote

Using @extend is more efficient for the bundled file size as it avoids code duplication by applying the same style to multiple selectors. However, since @extend cannot use dynamic values, it is recommended to switch to @mixin only when you need dynamic values.

@mixin is used for creating styles that require additional features like conditionals, loops, or user overrides, while @extend is used for simply copying existing styles.

Therefore, it is best to use them according to the situation.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by MohamadSalman11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants