Question

Evening all,

Does anyone know if it is possible to create a mixin (or function) in Sass which returns some placeholder classes that can be used else where.

Something like this:

@mixin placeholder-maker($columns) {
    @for $i from 1 through $columns {
        %g-cols-#{$i} {
            @include grid-columns($i)
        }
    }
}

@include placeholder-maker($columns: 12);

Thanks

Was it helpful?

Solution

May you can do this a little simpler:

$columns: 12;

@for $i from 1 through $columns {
  %g-cols-#{$i} {
    @include grid-columns($i);
  }
}

.example{
  @extend %g-cols-1;
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top