Sha256: 974662e7a21c509d3de7eb435c4839df90e58dc81f7cb1ce20c9c82cb1ee038f

Contents?: true

Size: 909 Bytes

Versions: 2

Compression:

Stored size: 909 Bytes

Contents

// My modified version of Karl Merkli's rem mixin from http://css-tricks.com/snippets/css/less-mixin-for-rem-font-sizing/.

// Pass in a property name and the target pixel values and the mixin will spit out the pixel fallback version and the rem version.

@mixin rem-fallback($property, $values...) {
  $max: length($values);
  $pxValues: '';
  $remValues: '';

  @for $i from 1 through $max {
    $value: strip-unit(nth($values, $i));

    // If the value is '0' don't output the unit.
    @if $value == 0 {
      $pxValues: #{$pxValues + $value*1};
      $remValues: #{$remValues + $value/16};
    }

    // Else do output the unit.
    @else {
      $pxValues: #{$pxValues + $value*1}px;
      $remValues: #{$remValues + $value/16}rem;
    }

    @if $i < $max {
      $pxValues: #{$pxValues + " "};
      $remValues: #{$remValues + " "};
    }
  }

  #{$property}: $pxValues;
  #{$property}: $remValues;
}

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
minable-0.0.2 app/assets/stylesheets/helpers/mixins/_rem-fallback.scss
minable-0.0.1 app/assets/stylesheets/helpers/mixins/_rem-fallback.scss