I have been reading through a couple of answers but none of these help me where I need it.
I want to write a rule for borders that consist of three variables. The first is optional and makes clear which side the border should be on (top, right, bottom or left; if not present the default should simply be border:
). The second one defines the width of the border and the latter the colour. I tried something like this. But that doesn't work unfortunately, because I don't provide a third argument I am guessing.
@mixin border($direction,$size,$colour) {
@if variable-exists($direction) {
border-#{$direction}: $size solid $colour;
} @else {
border: $size solid $colour;
}
}
$borderradius: 2px;
$borderSize: 1px;
$mainColour: #ccc;
$hoverColour: #4679bd;
@include border($borderSize, $mainColour);