2d3ca553 |
1 | @charset "UTF-8"; |
2 | |
3 | /// Transforms shorthand that can range from 1-to-4 values to be 4 values. |
4 | /// |
5 | /// @argument {list} $shorthand |
6 | /// |
7 | /// @example scss |
8 | /// .element { |
9 | /// margin: _unpack-shorthand(1em 2em); |
10 | /// } |
11 | /// |
12 | /// // CSS Output |
13 | /// .element { |
14 | /// margin: 1em 2em 1em 2em; |
15 | /// } |
16 | /// |
17 | /// @access private |
18 | |
19 | @function _unpack-shorthand($shorthand) { |
20 | @if length($shorthand) == 1 { |
21 | @return nth($shorthand, 1) nth($shorthand, 1) nth($shorthand, 1) nth($shorthand, 1); |
22 | } @else if length($shorthand) == 2 { |
23 | @return nth($shorthand, 1) nth($shorthand, 2) nth($shorthand, 1) nth($shorthand, 2); |
24 | } @else if length($shorthand) == 3 { |
25 | @return nth($shorthand, 1) nth($shorthand, 2) nth($shorthand, 3) nth($shorthand, 2); |
26 | } @else { |
27 | @return $shorthand; |
28 | } |
29 | } |