Is this bad practice or why does nobody do it? I'd considere this as really helpful with certain properties you'd use over and over again through larger projects, like your own framework etc, since it keeps the code short and makes it easy to edit.
$flex: '.nav', 'nav', '.grid', '.row';
$inline-flex: '.button', 'button', '.icon';
@mixin passElement($list, $property, $value) {
%#{$value} {
#{$property}: #{$value};
}
@each $element in #{$list} {
#{$element} {
@extend %#{$value};
}
}
}
@include passElement($flex, display, flex);
@include passElement($inline-flex, display, inline-flex);
This would compile to:
.nav, nav, .grid, .row {
display: flex;
}
.button, button, .icon {
display: inline-flex;
}