Reputation: 886
Is it posible to invoke a mixin doing something like this?
@mixin font-mixin ($mixinName, $color) {
@include #{$mixinName};
color: $color;
}
I mean I tried that, it does not work but,is there any way to do something like this? I want to dynamically call a mixin providing the name of the mixin I need to invoke as parameter of another mixin since it will help reducing a lot of code in my project
Upvotes: 1
Views: 349
Reputation: 9002
You can't do this directly, but you can work around it. You could do kind of a switch statement:
@mixin breakpoint($mixin) {
@if $mixin == mixin1 {
@include mixin1;
}
@if $mixin == mixin2 {
@include mixin2;
}
}
Upvotes: 1