Skip to content

Instantly share code, notes, and snippets.

@robtarr
Last active December 11, 2015 03:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save robtarr/4539235 to your computer and use it in GitHub Desktop.
Save robtarr/4539235 to your computer and use it in GitHub Desktop.
Working on rem-fix SCSS mixin
@mixin rem( $property, $a:0, $b:$a, $c:$a, $d:$b ) {
@if ( $property == "font-size" ) {
// $a is the font size
// %b is the keyword
@if ( $a != $b ) {
font-size: $b;
}
@else {
font-size: $a * $base-font-multiplier * 16px;
}
font-size: $a * 1rem;
} @else {
$apx: $a * $base-font-multiplier * 16px;
$bpx: $b * $base-font-multiplier * 16px;
$cpx: $c * $base-font-multiplier * 16px;
$dpx: $d * $base-font-multiplier * 16px;
$arem: $a * 1rem;
$brem: $b * 1rem;
$crem: $c * 1rem;
$drem: $d * 1rem;
@if ( $property == "padding" or $property == "margin" ){
#{$property}: $apx $bpx $cpx $dpx;
#{$property}: $arem $brem $crem $drem;
} @else {
#{$property}: $apx;
#{$property}: $arem;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment