Skip to content

Instantly share code, notes, and snippets.

@stowball
Last active August 29, 2015 14:19
Show Gist options
  • Select an option

  • Save stowball/9f811aefcfde73dcaab1 to your computer and use it in GitHub Desktop.

Select an option

Save stowball/9f811aefcfde73dcaab1 to your computer and use it in GitHub Desktop.
Generated by SassMeister.com.
// ----
// Sass (v3.4.12)
// Compass (v1.0.3)
// ----
@mixin to-em($properties, $sizes, $context: $font-size, $sledgehammer: false) {
$values: ();
$sublists: false;
$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, #{$ss / $context}em, $ss));
}
$values: append($values, join((), $vv));
}
@else {
$values: append($values, if(type-of($s) == number, #{$s / $context}em,
$s));
}
}
$value: join((), $values, if($sublists, comma, space));
@each $prop in $properties {
#{$prop}: $value#{$important};
}
}
@mixin to-rem($properties, $sizes, $sledgehammer: "") {
$values: ();
$sublists: false;
@each $s in $sizes {
@if type-of($s) == list {
$sublists: true;
$vv: ();
@each $ss in $s {
$vv: append($vv, if(type-of($ss) == number, #{$ss / $font-size}rem,
$ss));
}
$values: append($values, join((), $vv));
}
@else {
$values: append($values, if(type-of($s) == number, #{$s / $font-size}rem,
$s));
}
}
$value: join((), $values, if($sublists, comma, space));
@each $prop in $properties {
#{$prop}: $value#{$sledgehammer};
}
}
$font-size: 16;
a {
@include to-em(margin, 16);
@include to-em(margin, 10, 12, true);
@include to-rem(padding, 12);
@include to-rem(padding, 12, true);
@include to-em(text-shadow, (#0d6e28 1 1) (#777 0 0 2), 20);
@include to-em(text-shadow, (#0d6e28 1 1) (#777 0 0 2), 20, true);
@include to-rem(text-shadow, (#0d6e28 1 1) (#777 0 0 2));
@include to-rem(text-shadow, (#0d6e28 1 1) (#777 0 0 2), true);
}
b {
@include to-em(margin padding, 12, 16, true);
@include to-em(margin padding, 16, false, true);
@include to-em(margin padding, 16, "", true);
}
a {
margin: 1em;
margin: 0.83333em!important;
padding: 0.75rem;
padding: 0.75remtrue;
text-shadow: #0d6e28 0.05em 0.05em, #777 0em 0em 0.1em;
text-shadow: #0d6e28 0.05em 0.05em, #777 0em 0em 0.1em!important;
text-shadow: #0d6e28 0.0625rem 0.0625rem, #777 0rem 0rem 0.125rem;
text-shadow: #0d6e28 0.0625rem 0.0625rem, #777 0rem 0rem 0.125remtrue;
}
b {
margin: 0.75em!important;
padding: 0.75em!important;
margin: 16/falseem!important;
padding: 16/falseem!important;
margin: 16/""em!important;
padding: 16/""em!important;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment