<commit_before>gulp = require 'gulp'

gutil        = require 'gulp-util'
del          = require 'del'
concat       = require 'gulp-concat'
coffee       = require 'gulp-coffee'
coffeelint   = require 'gulp-coffeelint'
browserify   = require 'browserify'
coffeeify    = require 'coffeeify'
watchify     = require 'watchify'
source       = require 'vinyl-source-stream'
sass         = require 'gulp-sass'
importCss    = require 'gulp-import-css'
autoprefixer = require 'gulp-autoprefixer'
uglify       = require 'gulp-uglify'
rename       = require 'gulp-rename'
minifyCss    = require 'gulp-minify-css'
livereload   = require('gulp-livereload')
zip          = require('gulp-zip')

gulp.task 'lint', ->
  gulp.src 'src/*.coffee'
    .pipe coffeelint()
    .pipe coffeelint.reporter 'default'

gulp.task 'clean:styles', ->
  del 'dist/*.css',
    force: true

buildStyles = (file) ->
  gulp.src file
    .pipe sass
        onError: (e) -> console.log e
    .pipe importCss()
    .pipe autoprefixer("last 2 versions", "> 1%", "ie 10")
    .pipe gulp.dest 'dist'

gulp.task 'build:styles', ['clean:styles'], ->
  buildStyles 'styles/slide-pack.scss'

gulp.task 'build:styles:watch', ['build:styles'], ->
  gulp.watch ['styles/**/*.scss'], ['build:styles']

gulp.task 'reload', ->
  livereload.listen()
  gulp.watch('dist/**').on('change', livereload.changed)
  gulp.watch('doc/**').on('change', livereload.changed)

bundleIt = (watch = false) ->
  bundler = browserify
      # Required watchify args
      cache: {}, packageCache: {}, fullPaths: true,
      entries: ['./src/index.coffee'],
      extensions: ['.coffee'],
      debug: true,
      ignoreMissing: true
  bundler.transform 'coffeeify'

  if watch
    bundler = watchify bundler

  rebundle = ->
    bundler.bundle()
      .on('error', gutil.log.bind(gutil, 'Browserify error'))
      .pipe source 'slide-pack.js'
      .pipe gulp.dest 'dist'

  bundler.on 'update', rebundle
  rebundle()

gulp.task 'clean:js', ->
  del 'dist/*.js',
    force: true

gulp.task 'uglify', ->
  gulp.src 'dist/*.js'
    .pipe rename suffix : '.min'
    .pipe uglify()
    .pipe gulp.dest 'dist'

gulp.task 'minifycss', ->
  gulp.src 'dist/*.css'
    .pipe rename suffix : '.min'
    .pipe minifyCss()
    .pipe gulp.dest 'dist'

gulp.task 'copy:templates', ->
  gulp.src 'templates/*.html'
    .pipe gulp.dest 'dist'

gulp.task 'dist:zip', ['copy:templates'], ->
  gulp.src 'dist/*'
    .pipe(zip('slide-pack.zip'))
    .pipe(gulp.dest 'dist')


gulp.task 'build:js', ['clean:js'], -> bundleIt()

gulp.task 'build:js:watch', ['clean:js'], -> bundleIt(true)

gulp.task 'minify', ['uglify', 'minifycss']

gulp.task 'build', ['build:js', 'build:styles']

gulp.task 'bundle', ['build', 'copy:templates', 'dist:zip']

gulp.task 'clean', ['clean:js', 'clean:styles']

gulp.task 'build:watch', ['build:js:watch', 'build:styles:watch', 'reload']

gulp.task 'default', ['build']<commit_msg>Ups. Fixed bundle generation task<commit_after>gulp = require 'gulp'

gutil        = require 'gulp-util'
del          = require 'del'
concat       = require 'gulp-concat'
coffee       = require 'gulp-coffee'
coffeelint   = require 'gulp-coffeelint'
browserify   = require 'browserify'
coffeeify    = require 'coffeeify'
watchify     = require 'watchify'
source       = require 'vinyl-source-stream'
sass         = require 'gulp-sass'
importCss    = require 'gulp-import-css'
autoprefixer = require 'gulp-autoprefixer'
uglify       = require 'gulp-uglify'
rename       = require 'gulp-rename'
minifyCss    = require 'gulp-minify-css'
livereload   = require('gulp-livereload')
zip          = require('gulp-zip')

gulp.task 'lint', ->
  gulp.src 'src/*.coffee'
    .pipe coffeelint()
    .pipe coffeelint.reporter 'default'

gulp.task 'clean:styles', ->
  del 'dist/*.css',
    force: true

buildStyles = (file) ->
  gulp.src file
    .pipe sass
        onError: (e) -> console.log e
    .pipe importCss()
    .pipe autoprefixer("last 2 versions", "> 1%", "ie 10")
    .pipe gulp.dest 'dist'

gulp.task 'build:styles', ['clean:styles'], ->
  buildStyles 'styles/slide-pack.scss'

gulp.task 'build:styles:watch', ['build:styles'], ->
  gulp.watch ['styles/**/*.scss'], ['build:styles']

gulp.task 'reload', ->
  livereload.listen()
  gulp.watch('dist/**').on('change', livereload.changed)
  gulp.watch('doc/**').on('change', livereload.changed)

bundleIt = (watch = false) ->
  bundler = browserify
      # Required watchify args
      cache: {}, packageCache: {}, fullPaths: true,
      entries: ['./src/index.coffee'],
      extensions: ['.coffee'],
      debug: true,
      ignoreMissing: true
  bundler.transform 'coffeeify'

  if watch
    bundler = watchify bundler

  rebundle = ->
    bundler.bundle()
      .on('error', gutil.log.bind(gutil, 'Browserify error'))
      .pipe source 'slide-pack.js'
      .pipe gulp.dest 'dist'

  bundler.on 'update', rebundle
  rebundle()

gulp.task 'clean:js', ->
  del 'dist/*.js',
    force: true

gulp.task 'uglify', ->
  gulp.src 'dist/*.js'
    .pipe rename suffix : '.min'
    .pipe uglify()
    .pipe gulp.dest 'dist'

gulp.task 'minifycss', ->
  gulp.src 'dist/*.css'
    .pipe rename suffix : '.min'
    .pipe minifyCss()
    .pipe gulp.dest 'dist'

gulp.task 'copy:templates', ->
  gulp.src 'templates/*.html'
    .pipe gulp.dest 'dist'


gulp.task 'build:js', ['clean:js'], -> bundleIt()

gulp.task 'build:js:watch', ['clean:js'], -> bundleIt(true)

gulp.task 'minify', ['uglify', 'minifycss']

gulp.task 'build', ['build:js', 'build:styles']

gulp.task 'bundle', ['build', 'copy:templates'], ->
  gulp.src ['dist/*.js', 'dist/*.css', 'dist/*.html']
    .pipe(zip('slide-pack.zip'))
    .pipe(gulp.dest 'dist')

gulp.task 'clean', ['clean:js', 'clean:styles']

gulp.task 'build:watch', ['build:js:watch', 'build:styles:watch', 'reload']

gulp.task 'default', ['build']
{'fraction_non_alphanumeric': 0.18191161356628982, 'fraction_numerical': 0.0013703323055841042, 'mean_word_length': 3.240377632534495, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 37, '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': '1625603', 'n_tokens_mistral': 2173, 'n_tokens_neox': 2129, 'n_words': 461}