Using those two answers, I came up with this mixin:
SASS
@mixin col-mod($n, $max) {
%mod-#{$n} {
@content;
}
$i: $n;
@while $i <= $max {
.col-#{$i} {
@extend %mod-#{$n}
}
$i: $i+$n;
}
}
@include col-mod(3, 12) {
/* Your styles here */
}
Output CSS
.col-3, .col-6, .col-9, .col-12 {
/* Your styles here */
}