Reputation: 257
Is there any way to check argument in mixins. For example, I have a shadow mixin and want to include it (call it) different way in case of its argument.
@mixin shadow($shadow, $position, $color) { ..... }
If I pass Top2 it should change only first parameter
.box { @include shadow(inset, Top2, #000); } => `box-shadow: inset, 2px 0 0 0, #000`
If I pass Bottom2 it should change the parameter to -2px
.box { @include shadow(inset, Bottom2, #000); } => `box-shadow: inset, -2px 0 0 0, #000`
Upvotes: 0
Views: 228
Reputation: 661
I think you should use this type.
@mixin box-shadow($values) {
-webkit-box-shadow: $values;
-moz-box-shadow: $values;
box-shadow: $values;
}
@mixin box-shadow-inset($inset) {
-webkit-box-shadow: $inset;
-moz-box-shadow: $inset;
box-shadow: $inset;
}
Upvotes: 2