Advertisement
Guest User

Untitled

a guest
May 30th, 2015
296
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.25 KB | None | 0 0
  1. // ----
  2. // Sass (v3.4.12)
  3. // Compass (v1.0.3)
  4. // ----
  5.  
  6. @mixin to-em-or-rem($unit, $properties, $sizes, $context, $sledgehammer) {
  7.  
  8. $values: ();
  9. $sublists: false;
  10. $unit: if($unit == "em", unquote("em"), unquote("rem"));
  11. $important: if($sledgehammer, " !important", "");
  12.  
  13. @each $s in $sizes {
  14.  
  15. @if type-of($s) == list {
  16. $sublists: true;
  17. $vv: ();
  18.  
  19. @each $ss in $s {
  20. $vv: append($vv, if(type-of($ss) == number and $ss != 0, #{$ss / $context}#{$unit}, $ss));
  21. }
  22.  
  23. $values: append($values, join((), $vv));
  24. }
  25.  
  26. @else {
  27. $values: append($values, if(type-of($s) == number and $s != 0, #{$s / $context}#{$unit},
  28. $s));
  29. }
  30. }
  31.  
  32. $value: join((), $values, if($sublists, comma, space));
  33.  
  34. @each $prop in $properties {
  35. #{$prop}: $value#{$important};
  36. }
  37. }
  38.  
  39. @mixin to-em($properties, $sizes, $context: false, $sledgehammer: false) {
  40. $context: if($context, $context, $font-size);
  41. @include to-em-or-rem("em", $properties, $sizes, $context, $sledgehammer);
  42. }
  43.  
  44. @mixin to-rem($properties, $sizes, $sledgehammer: false) {
  45. @include to-em-or-rem("rem", $properties, $sizes, $font-size, $sledgehammer);
  46. }
  47.  
  48. $font-size: 16;
  49.  
  50. a {
  51. @include to-em(margin padding, 16, 12, true);
  52. @include to-em(margin padding, 16, true);
  53. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement