Sha256: 150d5ff027d436602ca2ea489cacd55378cf2cc14bf31a8512c66d583c2765e1

Contents?: true

Size: 693 Bytes

Versions: 6

Compression:

Stored size: 693 Bytes

Contents

//************************************************************************//
// Helper function for str-to-num fn.
// Source: http://sassmeister.com/gist/9647408
//************************************************************************//
@function _convert-units($number, $unit) {
  $strings: "px" "cm" "mm" "%" "ch" "pica" "in" "em" "rem" "pt" "pc" "ex" "vw" "vh" "vmin" "vmax", "deg", "rad", "grad", "turn";
  $units:   1px  1cm  1mm  1%  1ch  1pica  1in  1em  1rem  1pt  1pc  1ex  1vw  1vh  1vmin  1vmax, 1deg, 1rad, 1grad, 1turn;
  $index: index($strings, $unit);

  @if not $index {
    @warn "Unknown unit `#{$unit}`.";
    @return false;
  }
  @return $number * nth($units, $index);
}

Version data entries

6 entries across 6 versions & 2 rubygems

Version Path
soffes-blog-jekyll-0.2.0 _sass/bourbon/helpers/_convert-units.scss
soffes-blog-jekyll-0.1.0 _sass/bourbon/helpers/_convert-units.scss
bourbon-4.2.1 app/assets/stylesheets/helpers/_convert-units.scss
bourbon-4.2.0 app/assets/stylesheets/helpers/_convert-units.scss
bourbon-4.2.0.beta app/assets/stylesheets/helpers/_convert-units.scss
bourbon-4.2.0.pre app/assets/stylesheets/helpers/_convert-units.scss