Sha256: fe77698288048b5bf9773dbf39dcd0ab5bb198b9387e8ae00ead449d237b495a

Contents?: true

Size: 909 Bytes

Versions: 18

Compression:

Stored size: 909 Bytes

Contents

@charset "UTF-8";

/// Transforms shorthand to its shortest possible form.
///
/// @argument {list} $values
///   List of directional values.
///
/// @example scss
///   $values: _compact-shorthand(10px 20px 10px 20px);
///
///   // Output
///   $values: 10px 20px;
///
/// @return {list}
///
/// @access private

@function _compact-shorthand($values) {
  $output: null;

  $a: nth($values, 1);
  $b: if(length($values) < 2, $a, nth($values, 2));
  $c: if(length($values) < 3, $a, nth($values, 3));
  $d: if(length($values) < 2, $a, nth($values, if(length($values) < 4, 2, 4)));

  @if $a == 0 { $a: 0; }
  @if $b == 0 { $b: 0; }
  @if $c == 0 { $c: 0; }
  @if $d == 0 { $d: 0; }

  @if $a == $b and $a == $c and $a == $d {
    $output: $a;
  } @else if $a == $c and $b == $d {
    $output: $a $b;
  } @else if $b == $d {
    $output: $a $b $c;
  } @else {
    $output: $a $b $c $d;
  }

  @return $output;
}

Version data entries

18 entries across 18 versions & 3 rubygems

Version Path
baseline-scss-0.5.0 src/vendors/bourbon/utilities/_compact-shorthand.scss
baseline-scss-0.4.4 src/vendors/bourbon/utilities/_compact-shorthand.scss
baseline-scss-0.4.3 src/vendors/bourbon/utilities/_compact-shorthand.scss
baseline-scss-0.4.2 src/vendors/bourbon/utilities/_compact-shorthand.scss
baseline-scss-0.4.1 src/vendors/bourbon/utilities/_compact-shorthand.scss
baseline-scss-0.4.0 src/vendors/bourbon/utilities/_compact-shorthand.scss
baseline-scss-0.3.3 src/vendors/bourbon/utilities/_compact-shorthand.scss
baseline-scss-0.3.2 src/vendors/bourbon/utilities/_compact-shorthand.scss
baseline-scss-0.3.1 src/vendors/bourbon/utilities/_compact-shorthand.scss
baseline-scss-0.3.0 src/vendors/bourbon/utilities/_compact-shorthand.scss
bourbon-7.3.0 core/bourbon/utilities/_compact-shorthand.scss
bourbon-7.2.0 core/bourbon/utilities/_compact-shorthand.scss
bourbon-7.1.0 core/bourbon/utilities/_compact-shorthand.scss
geekspace-3.2.0 _sass/bourbon/bourbon/utilities/_compact-shorthand.scss
geekspace-3.1.2 _sass/bourbon/bourbon/utilities/_compact-shorthand.scss
geekspace-3.1.1 _sass/bourbon/bourbon/utilities/_compact-shorthand.scss
bourbon-7.0.0 core/bourbon/utilities/_compact-shorthand.scss
bourbon-6.0.0 core/bourbon/utilities/_compact-shorthand.scss