Skip to content
This repository
Phil LaPier March 20, 2014
file 43 lines (34 sloc) 1.332 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
//************************************************************************//
// Background-image property for adding multiple background images with
// gradients, or for stringing multiple gradients together.
//************************************************************************//

@mixin background-image($images...) {
  $webkit-images: ();
  $spec-images: ();

  @each $image in $images {
    $webkit-image: ();
    $spec-image: ();

    @if (type-of($image) == string) {
      $url-str: str-slice($image, 0, 3);
      $gradient-type: str-slice($image, 0, 6);

      @if $url-str == "url" {
        $webkit-image: $image;
          $spec-image: $image;
      }

      @else if $gradient-type == "linear" {
        $gradients: _linear-gradient-parser($image);
        $webkit-image: map-get($gradients, webkit-image);
        $spec-image: map-get($gradients, spec-image);
      }

      @else if $gradient-type == "radial" {
        $gradients: _radial-gradient-parser($image);
        $webkit-image: map-get($gradients, webkit-image);
        $spec-image: map-get($gradients, spec-image);
      }
    }

    $webkit-images: append($webkit-images, $webkit-image, comma);
    $spec-images: append($spec-images, $spec-image, comma);
  }

  background-image: $webkit-images;
  background-image: $spec-images;
}
Something went wrong with that request. Please try again.