<commit_before>require('es6-promise').polyfill(); // required to fix postcss-import?

var assetDest = 'asset/';
var jsSitemaps = false;
var settings = {
  watch: {
    css: 'css/**/*.css',
    js: 'js/**/*.js'
  },
  jsLibs: [
    'node_modules/mustache/mustache.js'
  ],
  css: 'css/',
  js: 'js/',
  media: ['media/']
};

var gulp = require('gulp');
var gutil = require('gulp-util');
var gulpConcat = require('gulp-concat');
var tap = require('gulp-tap');
var runSequence = require('run-sequence');
var jscs = require('gulp-jscs');
var uglify = require('gulp-uglify');
var cssmin = require('gulp-cssmin');
var imagemin = require('gulp-imagemin');
var pngquant = require('imagemin-pngquant');
var autoprefixer = require('autoprefixer');
var postcss = require('gulp-postcss');
var postcssImport = require('postcss-import');
var postcssCsscomb = require('postcss-csscomb');
var postcssCombOptions = require('./.csscomb.json');
var postcssColorFunction = require('postcss-color-function');
var postcssHexrgba = require('postcss-hexrgba');
var postcssConditionals = require('postcss-conditionals');
var postcssCustomProperties = require('postcss-custom-properties');
var postcssProcesses = [
  postcssImport,
  postcssCustomProperties(),
  postcssConditionals,
  postcssHexrgba(),
  postcssColorFunction(),
  autoprefixer({browsers: ['last 1 version']})
];
var browserify = require('browserify');
var stringify = require('stringify');
var buffer = require('gulp-buffer');

gulp.task('watch', watch);
gulp.task('min', min);
gulp.task('css', css);
gulp.task('cssMin', cssMin);
gulp.task('cssTidy', cssTidy);
gulp.task('js', js);
gulp.task('jsLib', jsLib);
gulp.task('jsMin', jsMin);
gulp.task('jsTidy', jsTidy);
gulp.task('mediaTidy', mediaTidy);
gulp.task('copy', copy);

function min() {
  runSequence(
    'cssMin',
    'jsMin'
  );
}

function watch() {
  gulp.watch(settings.watch.css, ['css']);
  gulp.watch(settings.watch.js, ['index.js']);
}

function js() {
  return gulp.src(settings.js + '**/*.bundle.js', {read: false})
    .pipe(tap(function(file) {
      file.contents = browserify(file.path, {debug: jsSitemaps})
        .transform(stringify, {
          global: true,
          appliesTo: {includeExtensions: ['.mst', '.mustache']},
          minify: true
        })
        .bundle();
      gutil.log('build ' + file.path);
    }))
    .pipe(buffer())
    .pipe(gulp.dest(assetDest));
};

function css() {
  return gulp.src(settings.css + '**/*.bundle.css')
    .pipe(postcss(postcssProcesses))
    .pipe(tap(function(file) {
      gutil.log('build ' + file.path);
    }))
    .pipe(gulp.dest(assetDest));
};

function cssMin() {
  return gulp.src(assetDest + '**/*.css')
    .pipe(cssmin())
    .pipe(tap(function(file) {
      gutil.log('minify ' + file.path);
    }))
    .pipe(gulp.dest(assetDest));
}

function cssTidy() {
  return gulp.src(settings.css + '**/*.css')
    .pipe(postcss([postcssCsscomb(postcssCombOptions)]))
    .pipe(tap(function(file) {
      gutil.log('tidy ' + file.path);
    }))
    .pipe(gulp.dest('css'));
}

function jsLib() {
  gulp.src(settings.jsLibs)
    .pipe(tap(function(file) {
      gutil.log('concat ' + file.path);
    }))
    .pipe(gulpConcat('lib.js'))
    .pipe(gulp.dest(assetDest));
}

function jsMin() {
  return gulp.src(assetDest + '**.js')
    .pipe(uglify())
    .pipe(tap(function(file) {
      gutil.log('minify ' + file.path);
    }))
    .pipe(gulp.dest(assetDest));
}

function jsTidy() {
  return gulp.src([settings.js + '**/*.js'])
    .pipe(jscs({
      configPath: '.jsTidyGoogle.json',
      fix: true
    }))
    .pipe(gulp.dest('js'));
}

function mediaTidy() {
  return gulp.src(settings.media + '**')
    .pipe(imagemin({
      progressive: true,
      svgoPlugins: [{removeViewBox: false}],
      use: [pngquant()]
    }))
    .pipe(gulp.dest(assetDest));
}

function copy() {
  gulp.src(settings.media + '**').pipe(gulp.dest(assetDest));
}<commit_msg>default task<commit_after>var gulp = require('gulp');
var gutil = require('gulp-util');
var gulpConcat = require('gulp-concat');
var tap = require('gulp-tap');
var runSequence = require('run-sequence');
var jscs = require('gulp-jscs');
var uglify = require('gulp-uglify');
var cssmin = require('gulp-cssmin');
var imagemin = require('gulp-imagemin');
var pngquant = require('imagemin-pngquant');
var autoprefixer = require('autoprefixer');
var postcss = require('gulp-postcss');
var postcssImport = require('postcss-import');
var postcssCsscomb = require('postcss-csscomb');
var postcssCombOptions = require('./.csscomb.json');
var postcssColorFunction = require('postcss-color-function');
var postcssHexrgba = require('postcss-hexrgba');
var postcssConditionals = require('postcss-conditionals');
var postcssCustomProperties = require('postcss-custom-properties');
var browserify = require('browserify');
var stringify = require('stringify');
var buffer = require('gulp-buffer');

var postcssProcesses = [
  postcssImport,
  postcssCustomProperties(),
  postcssConditionals,
  postcssHexrgba(),
  postcssColorFunction(),
  autoprefixer({browsers: ['last 1 version']})
];
var assetDest = 'asset/';
var jsSitemaps = true;

gulp.task('default', buildProduction);
gulp.task('watch', watch);
gulp.task('min', min);
gulp.task('css', css);
gulp.task('cssMin', cssMin);
gulp.task('cssTidy', cssTidy);
gulp.task('js', js);
gulp.task('jsLib', jsLib);
gulp.task('jsMin', jsMin);
gulp.task('jsTidy', jsTidy);
gulp.task('mediaTidy', mediaTidy);
gulp.task('copy', copy);

function buildProduction() {
  jsSitemaps = false;
  runSequence(
    'mediaTidy',
    'copy',
    'cssTidy',
    'css',
    'cssMin',
    'jsTidy',
    'js',
    'jsMin'
  );
}

function min() {
  runSequence(
    'cssMin',
    'jsMin'
  );
}

function watch() {
  gulp.watch('css/**/*.css', ['css']);
  gulp.watch('js/**/*.js', ['index.js']);
}

function js() {
  return gulp.src('js/' + '**/*.bundle.js', {read: false})
    .pipe(tap(function(file) {
      file.contents = browserify(file.path, {debug: jsSitemaps})
        .transform(stringify, {
          global: true,
          appliesTo: {includeExtensions: ['.mst', '.mustache']},
          minify: true
        })
        .bundle();
      gutil.log('build ' + file.path);
    }))
    .pipe(buffer())
    .pipe(gulp.dest(assetDest));
};

function css() {
  return gulp.src('css/' + '**/*.bundle.css')
    .pipe(postcss(postcssProcesses))
    .pipe(tap(function(file) {
      gutil.log('build ' + file.path);
    }))
    .pipe(gulp.dest(assetDest));
};

function cssMin() {
  return gulp.src(assetDest + '**/*.css')
    .pipe(cssmin())
    .pipe(tap(function(file) {
      gutil.log('minify ' + file.path);
    }))
    .pipe(gulp.dest(assetDest));
}

function cssTidy() {
  return gulp.src('css/' + '**/*.css')
    .pipe(postcss([postcssCsscomb(postcssCombOptions)]))
    .pipe(tap(function(file) {
      gutil.log('tidy ' + file.path);
    }))
    .pipe(gulp.dest('css'));
}

function jsLib() {
  gulp.src([
      'node_modules/mustache/mustache.js'
    ])
    .pipe(tap(function(file) {
      gutil.log('concat ' + file.path);
    }))
    .pipe(gulpConcat('lib.js'))
    .pipe(gulp.dest(assetDest));
}

function jsMin() {
  return gulp.src(assetDest + '**.js')
    .pipe(uglify())
    .pipe(tap(function(file) {
      gutil.log('minify ' + file.path);
    }))
    .pipe(gulp.dest(assetDest));
}

function jsTidy() {
  return gulp.src(['js/' + '**/*.js'])
    .pipe(jscs({
      configPath: '.jsTidyGoogle.json',
      fix: true
    }))
    .pipe(gulp.dest('js'));
}

function mediaTidy() {
  return gulp.src('media/' + '**')
    .pipe(imagemin({
      progressive: true,
      svgoPlugins: [{removeViewBox: false}],
      use: [pngquant()]
    }))
    .pipe(gulp.dest(assetDest));
}

function copy() {
  gulp.src('media/' + '**').pipe(gulp.dest(assetDest));
}
{'fraction_non_alphanumeric': 0.20105007043155335, 'fraction_numerical': 0.000384172109104879, 'mean_word_length': 3.8299319727891157, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '4347137', 'n_tokens_mistral': 2871, 'n_tokens_neox': 2837, 'n_words': 473}