<commit_before>'use strict';

var gulp = require('gulp'),
    changed = require('gulp-changed'),
    sass = require('gulp-sass'),
    csso = require('gulp-csso'),
    runSequence = require('run-sequence'),
    autoprefixer = require('autoprefixer-core'),
    browserify = require('browserify'),
    ghPages = require('gulp-gh-pages'),
    watchify = require('watchify'),
    source = require('vinyl-source-stream'),
    buffer = require('vinyl-buffer'),
    eslint = require('gulp-eslint'),
    babelify = require('babelify'),
    uglify = require('gulp-uglify'),
    del = require('del'),
    notify = require('gulp-notify'),
    browserSync = require('browser-sync'),
    sourcemaps = require('gulp-sourcemaps'),
    postcss = require('gulp-postcss'),
    reload = browserSync.reload,
    imagemin = require('gulp-imagemin'),
    pngquant = require('imagemin-pngquant'),
    ghPages = require('gulp-gh-pages'),
    fs = require('fs'),
    _ = require('lodash'),
    p = {
      tmp: '.tmp',
      dist: 'dist',
      source: 'src',
      jsx: 'src/index.jsx',
      scss: 'src/index.scss',
      bundle: 'index.js',
      tmpJs: '.tmp/js',
      tmpCss: '.tmp/css',
      tmpImages: '.tmp/images',
      tmpFonts: '.tmp/fonts'
    };

gulp.task('clean', function(cb) {
  return del([p.tmp, '!dist/.git', 'dist/**/*'], cb);
});

gulp.task('browserSync', function() {
  browserSync({
    server: {
      baseDir: [p.source, p.tmp]
    }
  });
});

gulp.task('watchify', function() {
  var bundler = watchify(browserify(p.jsx, watchify.args));

  function rebundle() {
    return bundler
      .bundle()
      .on('error', notify.onError())
      .pipe(source(p.bundle))
      .pipe(gulp.dest(p.tmpJs))
      .pipe(reload({stream: true}));
  }

  bundler.transform(babelify)
  .on('update', rebundle);
  return rebundle();
});

gulp.task('browserify', function() {
  return browserify(p.jsx)
    .transform(babelify)
    .bundle()
    .pipe(source(p.bundle))
    .pipe(buffer())
    .pipe(sourcemaps.init({loadMaps: true}))
    .pipe(uglify())
    .pipe(sourcemaps.write('./'))
    .pipe(gulp.dest(p.tmpJs));
});

gulp.task('styles', function() {
  return gulp.src(p.scss)
    .pipe(changed(p.tmpCss))
    .pipe(sass({errLogToConsole: true}))
    .on('error', notify.onError())
    .pipe(postcss([autoprefixer('last 1 version')]))
    .pipe(csso())
    .pipe(gulp.dest(p.tmpCss))<commit_msg>Add sourcemaps support for the development mode.<commit_after>'use strict';

var gulp = require('gulp'),
    changed = require('gulp-changed'),
    sass = require('gulp-sass'),
    csso = require('gulp-csso'),
    runSequence = require('run-sequence'),
    autoprefixer = require('autoprefixer-core'),
    browserify = require('browserify'),
    ghPages = require('gulp-gh-pages'),
    watchify = require('watchify'),
    source = require('vinyl-source-stream'),
    buffer = require('vinyl-buffer'),
    eslint = require('gulp-eslint'),
    babelify = require('babelify'),
    uglify = require('gulp-uglify'),
    del = require('del'),
    notify = require('gulp-notify'),
    browserSync = require('browser-sync'),
    sourcemaps = require('gulp-sourcemaps'),
    postcss = require('gulp-postcss'),
    reload = browserSync.reload,
    imagemin = require('gulp-imagemin'),
    pngquant = require('imagemin-pngquant'),
    ghPages = require('gulp-gh-pages'),
    assign = require('object-assign'),
    fs = require('fs'),
    _ = require('lodash'),
    p = {
      tmp: '.tmp',
      dist: 'dist',
      source: 'src',
      jsx: 'src/index.jsx',
      scss: 'src/index.scss',
      bundle: 'index.js',
      tmpJs: '.tmp/js',
      tmpCss: '.tmp/css',
      tmpImages: '.tmp/images',
      tmpFonts: '.tmp/fonts'
    };

gulp.task('clean', function(cb) {
  return del([p.tmp, '!dist/.git', 'dist/**/*'], cb);
});

gulp.task('browserSync', function() {
  browserSync({
    server: {
      baseDir: [p.source, p.tmp]
    }
  });
});

gulp.task('watchify', function() {
  var customOpts = {
    entries: [p.jsx],
    debug: true
  };
  var opts = assign({}, watchify.args, customOpts);
  var bundler = watchify(browserify(p.jsx, opts));

  function rebundle() {
    return bundler
      .bundle()
      .on('error', notify.onError())
      .pipe(source(p.bundle))
      .pipe(buffer())
      .pipe(sourcemaps.init({loadMaps: true}))
      .pipe(sourcemaps.write('./'))
      .pipe(gulp.dest(p.tmpJs))
      .pipe(reload({stream: true}));
  }

  bundler.transform(babelify)
  .on('update', rebundle);
  return rebundle();
});

gulp.task('browserify', function() {
  return browserify(p.jsx)
    .transform(babelify)
    .bundle()
    .pipe(source(p.bundle))
    .pipe(buffer())
    .pipe(sourcemaps.init({loadMaps: true}))
    .pipe(uglify())
    .pipe(sourcemaps.write('./'))
    .pipe(gulp.dest(p.tmpJs));
});

gulp.task('styles', function() {
  return gulp.src(p.scss)
    .pipe(changed(p.tmpCss))
    .pipe(sass({errLogToConsole: true}))
    .on('error', notify.onError())
    .pipe(postcss([autoprefixer('last 1 version')]))
    .pipe(csso())
    .pipe(gulp.dest(p.tmpCss))
{'fraction_non_alphanumeric': 0.1989735491512041, 'fraction_numerical': 0.00039478878799842083, 'mean_word_length': 3.2049792531120334, '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': '1587055', 'n_tokens_mistral': 1804, 'n_tokens_neox': 1775, 'n_words': 294}