| 1 |
@charset "UTF-8"; |
| 2 |
|
| 3 |
/// Converts shorthand to the 4-value syntax. |
| 4 |
/// |
| 5 |
/// @param {List} $shorthand |
| 6 |
/// |
| 7 |
/// @example scss - Usage |
| 8 |
/// .element { |
| 9 |
/// margin: unpack(1em 2em); |
| 10 |
/// } |
| 11 |
/// |
| 12 |
/// @example css - CSS Output |
| 13 |
/// .element { |
| 14 |
/// margin: 1em 2em 1em 2em; |
| 15 |
/// } |
| 16 |
|
| 17 |
@function unpack($shorthand) { |
| 18 |
@if $output-bourbon-deprecation-warnings == true { |
| 19 |
@warn "[Bourbon] [Deprecation] `unpack` is deprecated and will be " + |
| 20 |
"removed in 5.0.0."; |
| 21 |
} |
| 22 |
|
| 23 |
@if length($shorthand) == 1 { |
| 24 |
@return nth($shorthand, 1) nth($shorthand, 1) nth($shorthand, 1) nth($shorthand, 1); |
| 25 |
} @else if length($shorthand) == 2 { |
| 26 |
@return nth($shorthand, 1) nth($shorthand, 2) nth($shorthand, 1) nth($shorthand, 2); |
| 27 |
} @else if length($shorthand) == 3 { |
| 28 |
@return nth($shorthand, 1) nth($shorthand, 2) nth($shorthand, 3) nth($shorthand, 2); |
| 29 |
} @else { |
| 30 |
@return $shorthand; |
| 31 |
} |
| 32 |
} |