| 1 |
//************************************************************************// |
| 2 |
// Background property for adding multiple backgrounds using shorthand |
| 3 |
// notation. |
| 4 |
//************************************************************************// |
| 5 |
|
| 6 |
@mixin background($backgrounds...) { |
| 7 |
@include _bourbon-deprecate-for-prefixing("background"); |
| 8 |
|
| 9 |
$webkit-backgrounds: (); |
| 10 |
$spec-backgrounds: (); |
| 11 |
|
| 12 |
@each $background in $backgrounds { |
| 13 |
$webkit-background: (); |
| 14 |
$spec-background: (); |
| 15 |
$background-type: type-of($background); |
| 16 |
|
| 17 |
@if $background-type == string or $background-type == list { |
| 18 |
$background-str: if($background-type == list, nth($background, 1), $background); |
| 19 |
|
| 20 |
$url-str: str-slice($background-str, 1, 3); |
| 21 |
$gradient-type: str-slice($background-str, 1, 6); |
| 22 |
|
| 23 |
@if $url-str == "url" { |
| 24 |
$webkit-background: $background; |
| 25 |
$spec-background: $background; |
| 26 |
} |
| 27 |
|
| 28 |
@else if $gradient-type == "linear" { |
| 29 |
$gradients: _linear-gradient-parser("#{$background}"); |
| 30 |
$webkit-background: map-get($gradients, webkit-image); |
| 31 |
$spec-background: map-get($gradients, spec-image); |
| 32 |
} |
| 33 |
|
| 34 |
@else if $gradient-type == "radial" { |
| 35 |
$gradients: _radial-gradient-parser("#{$background}"); |
| 36 |
$webkit-background: map-get($gradients, webkit-image); |
| 37 |
$spec-background: map-get($gradients, spec-image); |
| 38 |
} |
| 39 |
|
| 40 |
@else { |
| 41 |
$webkit-background: $background; |
| 42 |
$spec-background: $background; |
| 43 |
} |
| 44 |
} |
| 45 |
|
| 46 |
@else { |
| 47 |
$webkit-background: $background; |
| 48 |
$spec-background: $background; |
| 49 |
} |
| 50 |
|
| 51 |
$webkit-backgrounds: append($webkit-backgrounds, $webkit-background, comma); |
| 52 |
$spec-backgrounds: append($spec-backgrounds, $spec-background, comma); |
| 53 |
} |
| 54 |
|
| 55 |
background: $webkit-backgrounds; |
| 56 |
background: $spec-backgrounds; |
| 57 |
} |