<commit_before>// Background image property for support with adding multiple background images with a gradients.

@mixin background-image(
  $image-1       , $image-2: false,
  $image-3: false, $image-4: false,
  $image-5: false, $image-6: false,
  $image-7: false, $image-8: false,
  $image-9: false, $image-10: false
) {
  $images: compact($image-1, $image-2,
           $image-3, $image-4,
           $image-5, $image-6,
           $image-7, $image-8,
           $image-9, $image-10);

  $assets:    false;
  $gradients: false;
  $count: 0;

  //Find all asset images in list
  @for $i from 1 through length($images) {
    $type: type-of(nth($images, $i));

    @if $type == list {
      $count: $count + 1;
    }

    @else if $type == string {
      @if $assets == false {
        $assets: nth($images, $i);
      }

      @else {
        $assets: join($assets, nth($images, $i), comma);
      }
    }
  }

  // Find all gradients in list
  @for $i from 1 through length($images) {
    $type: type-of(nth($images, $i));

    @if $type == list {
      @if $gradients == false {
        $gradients: nth($images, $i);
      }
      @else {
        $gradients: $gradients, nth($images, $i);
      }
    }
  }

  @if $assets {
    @if $count >= 1 {
      background-image: $assets, render-gradients($gradients, webkit);
      background-image: $assets, render-gradients($gradients, moz);
      background-image: $assets, render-gradients($gradients, ms);
      background-image: $assets, render-gradients($gradients, o);
      background-image: $assets, render-gradients($gradients);

    }
    @else {
      background-image: $assets;
    }
  }
  @else {
    @if $count >= 1 {
      background-image: render-gradients($gradients, webkit);
      background-image: render-gradients($gradients, moz);
      background-image: render-gradients($gradients, ms);
      background-image: render-gradients($gradients, o);
      background-image: render-gradients($gradients);
    }
  }

}

@function render-gradients($gradients, $vendor: false) {
  @if $count == 1 {
    $vendor-gradients: false;
    @if $vendor {
      $vendor-gradients: -#{$vendor}-linear-gradient($gradients);
    }
    @else if $vendor == false {
      $vendor-gradients: "linear-gradient(#{$gradients})";
      $vendor-gradients: unquote($vendor-gradients);
    }
    @return $vendor-gradients;
  }

  @else if $count >= 2 {
    $vendor-gradients: false;
    @for $i from 1 through length($gradients) {
      @if $vendor {
        @if $vendor-gradients == false {
          $vendor-gradients: -#{$vendor}-linear-gradient(nth($gradients, $i));
        }
        @else {
          $vendor-gradients: $vendor-gradients, -#{$vendor}-linear-gradient(nth($gradients, $i));
        }
      }
      @else if $vendor == false {
        @if $vendor-gradients {
          $vendor-gradients: "linear-gradient(#{nth($gradients, $i)})";
          $vendor-gradients: unquote($vendor-gradients);
        }
        @else {
          $vendor-gradients: $vendor-gradients, "linear-gradient( #{nth($gradients, $i)} )";
          $vendor-gradients: unquote($vendor-gradients);
        }
      }
    }
    @return $vendor-gradients;
  }
}

//Examples:
   //@include background-image(url("/images/a.png"), linear-gradient(#ffff00, #999));
   //@include background-image(url("/images/a.png"), url("/images/b.png"), url("/images/c.png"), linear-gradient(#ffff00 10%, #000 20%));
<commit_msg>Refactored _background-image mixin. Fixes  issues. Works with Sass 3.1.8.<commit_after>// Background image property for support with adding multiple background images with a gradients.

@mixin background-image(
  $image-1       , $image-2: false,
  $image-3: false, $image-4: false,
  $image-5: false, $image-6: false,
  $image-7: false, $image-8: false,
  $image-9: false, $image-10: false
) {
  $images: compact($image-1, $image-2,
           $image-3, $image-4,
           $image-5, $image-6,
           $image-7, $image-8,
           $image-9, $image-10);

  $assets:    ();
  $gradients: ();
  $count: 0;

  //Find all asset images in list
  @for $i from 1 through length($images) {
    $type: type-of(nth($images, $i));

    @if $type == list {
      $count: $count + 1;
    }

    @else if $type == string {
      $assets: join($assets, nth($images, $i), comma);
    }
  }

  // Find all gradients in list
  @for $i from 1 through length($images) {
    $type: type-of(nth($images, $i));

    @if $type == list {
      $gradients: append($gradients, nth($images, $i), comma);
    }
  }


  @if $assets {
    @if $count >= 1 {
      background-image: $assets, render-gradients($gradients, webkit);
      background-image: $assets, render-gradients($gradients, moz);
      background-image: $assets, render-gradients($gradients, ms);
      background-image: $assets, render-gradients($gradients, o);
      background-image: $assets, render-gradients($gradients);
    }
    @else {
      background-image: $assets;
    }
  }
  @else {
    @if $count >= 1 {
      background-image: render-gradients($gradients, webkit);
      background-image: render-gradients($gradients, moz);
      background-image: render-gradients($gradients, ms);
      background-image: render-gradients($gradients, o);
      background-image: render-gradients($gradients);
    }
  }
}

@function render-gradients($gradients, $vendor: false) {
  @if length($gradients) == 1 {
    $vendor-gradients: false;
    @if $vendor {
      $vendor-gradients: -#{$vendor}-linear-gradient($gradients);
    }
    @else if $vendor == false {
      $vendor-gradients: "linear-gradient(#{$gradients})";
      $vendor-gradients: unquote($vendor-gradients);
    }
    @return $vendor-gradients;
  }

  @else if length($gradients) >= 2 {
    $vendor-gradients: ();
    @for $i from 1 through length($gradients) {
      @if $vendor {
        @if $vendor-gradients == () {
          $vendor-gradients: -#{$vendor}-linear-gradient(nth($gradients, $i));
        }
        @else {
          $vendor-gradients: $vendor-gradients, -#{$vendor}-linear-gradient(nth($gradients, $i));
        }
      }
      @else if $vendor == false {
        $vendor-gradients: $vendor-gradients, unquote("linear-gradient(#{nth($gradients, $i)})");
      }
    }
    @return $vendor-gradients;
  }
}

//Examples:
   //@include background-image(url("/images/a.png"), linear-gradient(#ffff00, #999));
   //@include background-image(url("/images/a.png"), url("/images/b.png"), url("/images/c.png"), linear-gradient(#ffff00 10%, #000 20%));
{'fraction_non_alphanumeric': 0.17664256039390674, 'fraction_numerical': 0.014309893829819972, 'mean_word_length': 2.7292025243832474, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5319148', 'n_tokens_mistral': 2268, 'n_tokens_neox': 2167, 'n_words': 468}