<commit_before>import gulp from 'gulp';
import plumber from 'gulp-plumber';

import jade from 'gulp-jade';
import stylus from 'gulp-stylus';
import babel from 'gulp-babel';
import flatten from 'gulp-flatten';

import imagemin from 'gulp-imagemin';

import useref from 'gulp-useref';
import gulpif from 'gulp-if';
import lazypipe from 'lazypipe';

import autoprefixer from 'gulp-autoprefixer';
import minifyCss from 'gulp-minify-css';
import uglify from 'gulp-uglify';

/**
 * Build Tasks:
 * Initial compilation and copying only
 */

gulp.task('jade', () => {
  return gulp.src(['./src/**/*.jade', '!./src/_partials/*.jade', '!./src/_layout.jade'])
    .pipe(plumber())
    .pipe(jade({
      basedir: './src',
      pretty: true
    }))
    .pipe(gulp.dest('./build'));
})

gulp.task('stylus', () => {
  return gulp.src('./src/css/index.styl')
    .pipe(plumber())
    .pipe(stylus())
    .pipe(gulp.dest('./build/css'));
});

gulp.task('babel', () => {
  return gulp.src('./src/js/*.js')
    .pipe(plumber())
    .pipe(babel({
      presets: ["es2015"]
    }))
    .pipe(gulp.dest('./build/js'));
});

gulp.task('copy-img', () => {
  return gulp.src('./src/img/**/*')
    .pipe(gulp.dest('./build/img'));
});

// Copies all fonts into the `build/fonts` directory
gulp.task('flatten-fonts', () => {
  return gulp.src(['./src/vendor/**/*.{eot,svg,ttf,woff,woff2}', '!./src/vendor/Ionicons/src/*'])
    .pipe(flatten())
    .pipe(gulp.dest('./build/fonts'));
});

// Copies the `vendor` directory into the `build` directory
gulp.task('copy-vendor', () => {
  return gulp.src('./src/vendor/**/*')
    .pipe(gulp.dest('./build/vendor'));
});

gulp.task('build', ['jade', 'stylus', 'babel', 'copy-img', 'flatten-fonts', 'copy-vendor'], () => {
});

gulp.task('dev', ['build'], () => {
  gulp.watch('./src/**/*.jade', ['jade']);
  gulp.watch('./src/css/*.styl', ['stylus']);
  gulp.watch('./src/js/*.js', ['babel']);

  gulp.watch('./src/img/**/*', ['copy-img']);
  gulp.watch('./src/vendor/**/*', ['flatten-fonts', 'copy-vendor']);

  console.log("Watching files!");
});


/**
 * Produce Tasks:
 * Minification, optimization, etc.
 */

gulp.task('imagemin', () => {
  return gulp.src('./build/img/**/*')
    .pipe(imagemin({
        progressive: true
    }))
    .pipe(gulp.dest('./dist/img'));
});

gulp.task('copy-fonts', () => {
  return gulp.src('./build/fonts/**/*')
    .pipe(gulp.dest('./dist/fonts'));
});

// Copy the js files that won't be useref'd
gulp.task('copy-custom-vendor', () => {
  /*
  return gulp.src('./src/vendor/path/to/file')
    .pipe(gulp.dest('./dist/vendor/path/to/file'));
  */
});

gulp.task('useref', () => {
  let cssTasks = lazypipe()
    .pipe(autoprefixer, { cascade: false })
    .pipe(minifyCss, { keepSpecialComments: 0 });

  let jsTasks = lazypipe()<commit_msg>use cssnano<commit_after>import gulp from 'gulp';
import plumber from 'gulp-plumber';

import jade from 'gulp-jade';
import stylus from 'gulp-stylus';
import babel from 'gulp-babel';
import flatten from 'gulp-flatten';

import imagemin from 'gulp-imagemin';

import useref from 'gulp-useref';
import gulpif from 'gulp-if';
import lazypipe from 'lazypipe';

import autoprefixer from 'gulp-autoprefixer';
import cssnano from 'gulp-cssnano';
import uglify from 'gulp-uglify';

/**
 * Build Tasks:
 * Initial compilation and copying only
 */

gulp.task('jade', () => {
  return gulp.src(['./src/**/*.jade', '!./src/_partials/*.jade', '!./src/_layout.jade'])
    .pipe(plumber())
    .pipe(jade({
      basedir: './src',
      pretty: true
    }))
    .pipe(gulp.dest('./build'));
})

gulp.task('stylus', () => {
  return gulp.src('./src/css/index.styl')
    .pipe(plumber())
    .pipe(stylus())
    .pipe(gulp.dest('./build/css'));
});

gulp.task('babel', () => {
  return gulp.src('./src/js/*.js')
    .pipe(plumber())
    .pipe(babel({
      presets: ["es2015"]
    }))
    .pipe(gulp.dest('./build/js'));
});

gulp.task('copy-img', () => {
  return gulp.src('./src/img/**/*')
    .pipe(gulp.dest('./build/img'));
});

// Copies all fonts into the `build/fonts` directory
gulp.task('flatten-fonts', () => {
  return gulp.src(['./src/vendor/**/*.{eot,svg,ttf,woff,woff2}', '!./src/vendor/Ionicons/src/*'])
    .pipe(flatten())
    .pipe(gulp.dest('./build/fonts'));
});

// Copies the `vendor` directory into the `build` directory
gulp.task('copy-vendor', () => {
  return gulp.src('./src/vendor/**/*')
    .pipe(gulp.dest('./build/vendor'));
});

gulp.task('build', ['jade', 'stylus', 'babel', 'copy-img', 'flatten-fonts', 'copy-vendor'], () => {
});

gulp.task('dev', ['build'], () => {
  gulp.watch('./src/**/*.jade', ['jade']);
  gulp.watch('./src/css/*.styl', ['stylus']);
  gulp.watch('./src/js/*.js', ['babel']);

  gulp.watch('./src/img/**/*', ['copy-img']);
  gulp.watch('./src/vendor/**/*', ['flatten-fonts', 'copy-vendor']);

  console.log("Watching files!");
});


/**
 * Produce Tasks:
 * Minification, optimization, etc.
 */

gulp.task('imagemin', () => {
  return gulp.src('./build/img/**/*')
    .pipe(imagemin({
        progressive: true
    }))
    .pipe(gulp.dest('./dist/img'));
});

gulp.task('copy-fonts', () => {
  return gulp.src('./build/fonts/**/*')
    .pipe(gulp.dest('./dist/fonts'));
});

// Copy the js files that won't be useref'd
gulp.task('copy-custom-vendor', () => {
  /*
  return gulp.src('./src/vendor/path/to/file')
    .pipe(gulp.dest('./dist/vendor/path/to/file'));
  */
});

gulp.task('useref', () => {
  let cssTasks = lazypipe()
    .pipe(autoprefixer, { cascade: false })
    .pipe(cssnano, { discardComments: {removeAll: true} });

  let jsTasks = lazypipe()
{'fraction_non_alphanumeric': 0.2582604036435078, 'fraction_numerical': 0.0019646365422396855, 'mean_word_length': 3.3956043956043955, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 27, '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': '1827612', 'n_tokens_mistral': 2199, 'n_tokens_neox': 2114, 'n_words': 355}