Last active
August 29, 2015 14:19
-
-
Save jhonnymoreira/59fa33f9bf774243d78a to your computer and use it in GitHub Desktop.
Simple Sass mixing to add shorthand (and specific) padding while converting units to 'rem' with the Bourbon function rem().
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@mixin pad($paddings, $shorthand: true) { | |
$orientations: top right bottom left; | |
@if $shorthand { | |
@each $value in $paddings { | |
$paddings: set-nth($paddings, index($paddings, $value), rem($value)); | |
} | |
padding: $paddings; | |
} @else { | |
@for $i from 1 through length($paddings) { | |
@if nth($paddings, $i) != x { | |
padding-#{nth($orientations, $i)}: rem(nth($paddings, $i)); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment