Skip to content

Instantly share code, notes, and snippets.

@brianjhanson
Created April 22, 2015 16:19
Show Gist options
  • Save brianjhanson/100c6c62bc746027ba61 to your computer and use it in GitHub Desktop.
Save brianjhanson/100c6c62bc746027ba61 to your computer and use it in GitHub Desktop.
Generated by SassMeister.com.
// ----
// libsass (v3.1.0)
// ----
$spacings: (
small: rem(12),
base: rem(24),
medium: rem(32),
large: rem(48),
xlarge: rem(72),
xxlarge: rem(96),
xxxlarge: rem(144),
xxxxlarge: rem(216),
xxxxxlarge: rem(288)
);
@mixin space($args, $amount) {
$_directions: top right bottom left;
$_applications: padding margin;
$application: padding !default;
$direction: top !default;
@each $direction in $_directions {
$i: index($args, $direction);
@if $i { $direction: $direction }
}
@each $application in $_applications {
$i: index($args, $application);
@if $i { $application: $application }
}
$amount: map-get($spacings, $amount);
@if $amount {
#{$application}-#{$direction}: $amount;
} @else {
@warn "Uh oh. The key #{$amount} wasn't found in map $spacings";
}
}
.capsule-simple__view-btn {
margin-top: rem(32);
// Invalid spacings don't work
@include space(top padding, cheese);
// valid ones do
@include space(top padding, small);
}
.capsule-simple__view-btn {
margin-top: rem(32);
padding-top: rem(12); }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment