Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ----
- // Sass (v3.4.12)
- // Compass (v1.0.3)
- // ----
- @mixin to-em-or-rem($unit, $properties, $sizes, $context, $sledgehammer) {
- $values: ();
- $sublists: false;
- $unit: if($unit == "em", unquote("em"), unquote("rem"));
- $important: if($sledgehammer, " !important", "");
- @each $s in $sizes {
- @if type-of($s) == list {
- $sublists: true;
- $vv: ();
- @each $ss in $s {
- $vv: append($vv, if(type-of($ss) == number and $ss != 0, #{$ss / $context}#{$unit}, $ss));
- }
- $values: append($values, join((), $vv));
- }
- @else {
- $values: append($values, if(type-of($s) == number and $s != 0, #{$s / $context}#{$unit},
- $s));
- }
- }
- $value: join((), $values, if($sublists, comma, space));
- @each $prop in $properties {
- #{$prop}: $value#{$important};
- }
- }
- @mixin to-em($properties, $sizes, $context: false, $sledgehammer: false) {
- $context: if($context, $context, $font-size);
- @include to-em-or-rem("em", $properties, $sizes, $context, $sledgehammer);
- }
- @mixin to-rem($properties, $sizes, $sledgehammer: false) {
- @include to-em-or-rem("rem", $properties, $sizes, $font-size, $sledgehammer);
- }
- $font-size: 16;
- a {
- @include to-em(margin padding, 16, 12, true);
- @include to-em(margin padding, 16, true);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement