_unpack.scss 501 B

1234567891011121314151617
  1. // Convert shorthand to the 4-value syntax
  2. @function unpack($shorthand) {
  3. @if length($shorthand) == 1 {
  4. @return nth($shorthand, 1) nth($shorthand, 1) nth($shorthand, 1) nth($shorthand, 1);
  5. }
  6. @else if length($shorthand) == 2 {
  7. @return nth($shorthand, 1) nth($shorthand, 2) nth($shorthand, 1) nth($shorthand, 2);
  8. }
  9. @else if length($shorthand) == 3 {
  10. @return nth($shorthand, 1) nth($shorthand, 2) nth($shorthand, 3) nth($shorthand, 2);
  11. }
  12. @else {
  13. @return $shorthand;
  14. }
  15. }