3 /// Transforms shorthand to its shortest possible form.
5 /// @argument {list} $values
6 /// List of directional values.
9 /// $values: _compact-shorthand(10px 20px 10px 20px);
12 /// $values: 10px 20px;
18 @function _compact-shorthand($values) {
22 $b: if(length($values) < 2, $a, nth($values, 2));
23 $c: if(length($values) < 3, $a, nth($values, 3));
24 $d: if(length($values) < 2, $a, nth($values, if(length($values) < 4, 2, 4)));
26 @if $a == 0 { $a: 0; }
27 @if $b == 0 { $b: 0; }
28 @if $c == 0 { $c: 0; }
29 @if $d == 0 { $d: 0; }
31 @if $a == $b and $a == $c and $a == $d {
33 } @else if $a == $c and $b == $d {