Last active
June 1, 2016 06:14
-
-
Save sapphirus/aaf1a4365d56e2fc1d31cd291badefc7 to your computer and use it in GitHub Desktop.
Offset
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
| // ---- | |
| // Sass (v3.4.21) | |
| // Compass (v1.0.3) | |
| // ---- | |
| // Offset | |
| $offset-basesize: 16 !default; | |
| $offset-size-map: ( | |
| none: 0, | |
| tiny: $offset-basesize * .25, | |
| small: $offset-basesize * .5, | |
| medium: $offset-basesize, | |
| large: $offset-basesize * 1.5, | |
| xlarge: $offset-basesize * 2, | |
| xxlarge: $offset-basesize * 3, | |
| ); | |
| $offset-map: ( | |
| margin : "m", | |
| margin-top: "mt", | |
| margin-bottom: "mb", | |
| margin-left: "ml", | |
| margin-right: "mr", | |
| padding : "p", | |
| padding-top: "pt", | |
| padding-bottom: "pb", | |
| padding-left: "pl", | |
| padding-right: "pr", | |
| ); | |
| @mixin offset($name, $prop) { | |
| @each $size in map-keys($offset-size-map) { | |
| $val: map-get($offset-size-map, $size); | |
| .#{$name}-#{$size} { | |
| #{$prop}: #{$val}px !important; | |
| } | |
| } | |
| } | |
| @each $prop in map-keys($offset-map) { | |
| $name: map-get($offset-map, $prop); | |
| @include offset($name, $prop); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment