_background-image.scss 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. //************************************************************************//
  2. // Background-image property for adding multiple background images with
  3. // gradients, or for stringing multiple gradients together.
  4. //************************************************************************//
  5. @mixin background-image($images...) {
  6. $webkit-images: ();
  7. $spec-images: ();
  8. @each $image in $images {
  9. $webkit-image: ();
  10. $spec-image: ();
  11. @if (type-of($image) == string) {
  12. $url-str: str-slice($image, 0, 3);
  13. $gradient-type: str-slice($image, 0, 6);
  14. @if $url-str == "url" {
  15. $webkit-image: $image;
  16. $spec-image: $image;
  17. }
  18. @else if $gradient-type == "linear" {
  19. $gradients: _linear-gradient-parser($image);
  20. $webkit-image: map-get($gradients, webkit-image);
  21. $spec-image: map-get($gradients, spec-image);
  22. }
  23. @else if $gradient-type == "radial" {
  24. $gradients: _radial-gradient-parser($image);
  25. $webkit-image: map-get($gradients, webkit-image);
  26. $spec-image: map-get($gradients, spec-image);
  27. }
  28. }
  29. $webkit-images: append($webkit-images, $webkit-image, comma);
  30. $spec-images: append($spec-images, $spec-image, comma);
  31. }
  32. background-image: $webkit-images;
  33. background-image: $spec-images;
  34. }