Sha256: 167b055e09a2dc400b673e48d0c45fce150113f18833ef2238bf4afa35692dcf

Contents?: true

Size: 1.73 KB

Versions: 55

Compression:

Stored size: 1.73 KB

Contents

@function number($number)
  @if type-of($number) == number
    @return true
  @else
    @return null

@function number_list($values)
  @if list($values)
    @each $value in $values
      @if number($value)
        @return true
      @else
        @return null
  @else
    @return null

@function optional_number_list($values)
  @if type-of($values) == number
    @return true
  @else if number_list($values)
    @return true
  @else
    @return null

@function odd($number)
  @if ceil($number/2) != $number/2
    @return true
  @else
    @return null

@function even($number)
  @if ceil($number/2) == $number/2
    @return true
  @else
    @return null

@function strip_unit($number)
  // strip the units
  // That works. strip_unit(13.48cm) will return 13.48
  @if number($number)
    @return $number / ($number * 0 + 1)

@function unit_number($value)
  @if number($value) and not unitless($value)
    @return true
  @else
    @return null

@function unitless_number($value)
  @if number($value) and unitless($value)
    @return true
  @else
    @return null

@function px($value)
  @if number($value) and unit($value) == "px"
    @return true
  @else
    @return null

@function em($value)
  @if number($value) and unit($value) == "em"
    @return true
  @else
    @return null

@function percent($value)
  @if number($value) and unit($value) == "%"
    @return true
  @else
    @return null

@function px_to_em($px, $base-px)
  @if strip_unit($px) == 0
    @return 0
  @else if px($px)
    @return (strip_unit($px) / strip_unit($base-px)) * 1em
  @else if em($px)
    @return $px

@function em_to_px($em, $base-px: $baseline-px)
  @if $em == 0
    @return 0
  @else if em($em)
    @return (strip_unit($em) * strip_unit($base-px)) * 1px
  @else if px($em)
    @return $em

Version data entries

55 entries across 55 versions & 2 rubygems

Version Path
middleman-oulu-0.6.18 assets/stylesheets/settings/functions/_number.sass
middleman-oulu-0.6.16 assets/stylesheets/settings/functions/_number.sass
oulu-rails-0.6.16 vendor/assets/stylesheets/settings/functions/_number.sass
oulu-rails-0.6.15 vendor/assets/stylesheets/settings/functions/_number.sass
middleman-oulu-0.6.15 assets/stylesheets/settings/functions/_number.sass
oulu-rails-0.6.14 vendor/assets/stylesheets/settings/functions/_number.sass
oulu-rails-0.6.13 vendor/assets/stylesheets/settings/functions/_number.sass
middleman-oulu-0.6.12 assets/stylesheets/settings/functions/_number.sass
oulu-rails-0.6.12 vendor/assets/stylesheets/settings/functions/_number.sass
oulu-rails-0.6.11 vendor/assets/stylesheets/settings/functions/_number.sass
oulu-rails-0.6.10 vendor/assets/stylesheets/settings/functions/_number.sass
middleman-oulu-0.6.10 assets/stylesheets/settings/functions/_number.sass
middleman-oulu-0.6.9 assets/stylesheets/settings/functions/_number.sass
middleman-oulu-0.6.8 assets/stylesheets/settings/functions/_number.sass
middleman-oulu-0.6.7 assets/stylesheets/settings/functions/_number.sass
middleman-oulu-0.6.6 assets/stylesheets/settings/functions/_number.sass
middleman-oulu-0.6.5 assets/stylesheets/settings/functions/_number.sass
oulu-rails-0.6.5 vendor/assets/stylesheets/settings/functions/_number.sass
oulu-rails-0.6.4 vendor/assets/stylesheets/settings/functions/_number.sass
middleman-oulu-0.6.4 assets/stylesheets/settings/functions/_number.sass