<commit_before>'use strict';

var gulp = require('gulp');
var $ = require('gulp-load-plugins')({
    pattern: ['gulp-*', 'main-bower-files', 'del']
  });

var basePath = {
  src  : 'app/',
  dest : 'public/'
};

var srcAssets = {
  styles  : basePath.src + 'styles/',
  scripts : basePath.src + 'js/',
  images  : basePath.src + 'img/'
};

var destAssets = {
  styles  : basePath.dest + 'css/',
  scripts : basePath.dest + 'js/',
  images  : basePath.dest + 'img/',
  fonts   : basePath.dest + 'fonts/'
};

// gulp-minify-html https://npmjs.org/package/gulp-minify-html#options
var minifyHtmlOptions = {
  empty: true,
  spare: true,
  quotes: true
};

function handleError(err) {
  console.error(err.toString());
  this.emit('end');
}

gulp.task('styles', function() {
  return gulp.src(srcAssets.styles + '*.scss')
    .pipe($.sass())
    .on('error', handleError)
    .pipe($.autoprefixer('last 2 version'))
    .pipe($.minifyCss())
    .pipe($.replace('bower_components/bootstrap/dist/fonts', 'fonts'))
    .pipe(gulp.dest('.tmp'))
    .pipe($.size());
});

gulp.task('scripts', function() {
  return gulp.src(srcAssets.scripts + '**/*.js')
    .pipe($.jshint())
    .pipe($.jshint.reporter('jshint-stylish'))
    .pipe($.size());
});

gulp.task('partials', function() {
  return gulp.src('app/views/**/*.html')
    .pipe($.minifyHtml(minifyHtmlOptions))
    .pipe($.angularTemplatecache({
      root: 'views',
      standalone: true
    }))
    .pipe($.angularHtmlify())
    .pipe(gulp.dest('.tmp'))
    .pipe($.size());
});

gulp.task('html', ['styles', 'scripts', 'partials'], function() {
  var htmlFilter = $.filter('*.html'),
      jsFilter = $.filter('**/*.js'),
      cssFilter = $.filter('**/*.css'),
      userefAssets = $.useref.assets();

  return gulp.src('app/*.html')
    .pipe(userefAssets)
    .pipe(jsFilter)
    .pipe($.ngAnnotate())
    .pipe($.uglify())
    .pipe(jsFilter.restore())
    .pipe(cssFilter)
    .pipe($.csso())
    .pipe(cssFilter.restore())
    .pipe($.rev())
    .pipe(userefAssets.restore())
    .pipe($.useref())
    .pipe($.revReplace())
    .pipe(htmlFilter)
    .pipe($.minifyHtml(minifyHtmlOptions))
    .pipe(htmlFilter.restore())
    .pipe(gulp.dest('public'))
    .pipe($.size());
});

gulp.task('images', function() {
  return gulp.src(srcAssets.images + '**/*')
    .pipe(gulp.dest(destAssets.images))
    .pipe($.size());
});

gulp.task('fonts', function() {
  return gulp.src($.mainBowerFiles())
    .pipe($.filter('**/*.{eot,svg,ttf,woff,woff2}'))
    .pipe($.flatten())
    .pipe(gulp.dest(destAssets.fonts))
    .pipe($.size());
});

gulp.task('clean', function(cb) {
  $.del(['.tmp', 'public'], cb);
});

gulp.task('build', ['html', 'fonts', 'images']);
<commit_msg>aded imagemin for images gulp task<commit_after>'use strict';

var gulp = require('gulp');
var $ = require('gulp-load-plugins')({
    pattern: ['gulp-*', 'main-bower-files', 'del']
  });

var basePath = {
  src  : 'app/',
  dest : 'public/'
};

var srcAssets = {
  styles  : basePath.src + 'styles/',
  scripts : basePath.src + 'js/',
  images  : basePath.src + 'img/'
};

var destAssets = {
  styles  : basePath.dest + 'css/',
  scripts : basePath.dest + 'js/',
  images  : basePath.dest + 'img/',
  fonts   : basePath.dest + 'fonts/'
};

// gulp-minify-html https://npmjs.org/package/gulp-minify-html#options
var minifyHtmlOptions = {
  empty: true,
  spare: true,
  quotes: true
};

function handleError(err) {
  console.error(err.toString());
  this.emit('end');
}

gulp.task('styles', function() {
  return gulp.src(srcAssets.styles + '*.scss')
    .pipe($.sass())
    .on('error', handleError)
    .pipe($.autoprefixer('last 2 version'))
    .pipe($.minifyCss())
    .pipe($.replace('bower_components/bootstrap/dist/fonts', 'fonts'))
    .pipe(gulp.dest('.tmp'))
    .pipe($.size());
});

gulp.task('scripts', function() {
  return gulp.src(srcAssets.scripts + '**/*.js')
    .pipe($.jshint())
    .pipe($.jshint.reporter('jshint-stylish'))
    .pipe($.size());
});

gulp.task('partials', function() {
  return gulp.src('app/views/**/*.html')
    .pipe($.minifyHtml(minifyHtmlOptions))
    .pipe($.angularTemplatecache({
      root: 'views',
      standalone: true
    }))
    .pipe($.angularHtmlify())
    .pipe(gulp.dest('.tmp'))
    .pipe($.size());
});

gulp.task('html', ['styles', 'scripts', 'partials'], function() {
  var htmlFilter = $.filter('*.html'),
      jsFilter = $.filter('**/*.js'),
      cssFilter = $.filter('**/*.css'),
      userefAssets = $.useref.assets();

  return gulp.src('app/*.html')
    .pipe(userefAssets)
    .pipe(jsFilter)
    .pipe($.ngAnnotate())
    .pipe($.uglify())
    .pipe(jsFilter.restore())
    .pipe(cssFilter)
    .pipe($.csso())
    .pipe(cssFilter.restore())
    .pipe($.rev())
    .pipe(userefAssets.restore())
    .pipe($.useref())
    .pipe($.revReplace())
    .pipe(htmlFilter)
    .pipe($.minifyHtml(minifyHtmlOptions))
    .pipe(htmlFilter.restore())
    .pipe(gulp.dest('public'))
    .pipe($.size());
});

gulp.task('images', function() {
  return gulp.src(srcAssets.images + '**/*')
    .pipe($.imagemin({
      optimizationLevel: 4,
      progressive: true,
      interlaced: true
    }))
    .pipe(gulp.dest(destAssets.images))
    .pipe($.size());
});

gulp.task('fonts', function() {
  return gulp.src($.mainBowerFiles())
    .pipe($.filter('**/*.{eot,svg,ttf,woff,woff2}'))
    .pipe($.flatten())
    .pipe(gulp.dest(destAssets.fonts))
    .pipe($.size());
});

gulp.task('clean', function(cb) {
  $.del(['.tmp', 'public'], cb);
});

gulp.task('build', ['html', 'fonts', 'images']);

{'fraction_non_alphanumeric': 0.2385222381635581, 'fraction_numerical': 0.000896700143472023, 'mean_word_length': 3.3367029548989113, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, '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': '3338574', 'n_tokens_mistral': 2126, 'n_tokens_neox': 2097, 'n_words': 310}