Created
March 9, 2016 12:01
-
-
Save 1stevengrant/3dbcac2d6f4421f1017c to your computer and use it in GitHub Desktop.
I wanted a way to generate helper classes for paddings and margins without having to add them all individually. The result is a Sass list containing my values and then looping over these to give me ```.M-T--0 .M-T--1``` etc.
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
$margin-sides : ("A": "margin", "T": "margin-top", "R": "margin-right", "B": "margin-bottom", "L": "margin-left") | |
$padding-sides : ("A": "padding", "T": "padding-top", "R": "padding-right", "B": "padding-bottom", "L": "padding-left") | |
$sizes : (0: 0, 1: 1em, 2: 2em, 3: 3em, 4: 4em) | |
@each $side, $property in $margin-sides | |
@each $key, $value in $sizes | |
.M-#{$side}--#{$key} | |
#{$property}: $value | |
@each $side, $property in $padding-sides | |
@each $key, $value in $sizes | |
.P-#{$side}--#{$key} | |
#{$property}: $value |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment