Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
spacer Function
/**
Create spacer function
.foo {
padding: spacer(1);
margin: spacer(1.5) 0;
}
compiles to:
.foo {
padding: 10px;
margin: 15px 0;
}
**/
@function spacer($value) {
@if ($value * 2) % 1 != 0 {
@warn 'Spacer value must be a multiple of 0.5';
@return 'Spacer value must be a multiple of 0.5';
} @else {
@return $spacer-unit * $value;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.