<commit_before>require! {
  fs
  child_process: {spawn}

  'prelude-ls': {union}
  'require-clean'

  gulp
  'gulp-util': gutil
  'run-sequence'
}

$ = require('gulp-load-plugins')()

# ----- bootstrap ----------------------------------------------------

console.error('[INFO] Checking `.env` file');
fs.statSync('.env');


# ----- webpack ------------------------------------------------------

run-webpack = (opt, prod) ->
  defaults = [
    '--colors'
    '--progress'
    '--display-chunks'
  ]
  opt = union opt, defaults


  message = if opt.length > 0
    "Run webpack with options `#{opt.join(' ')}`"
  else
    'Run webpack without options'

  message += ' with optimize' if prod
  gutil.log message

  process.env.WEBPACK_ENV = if prod then 'production' else 'development'
  spawn 'webpack', opt, stdio: 'inherit'


gulp.task \webpack, [\webpack-preload], ->
  run-webpack []


gulp.task \webpack-prod, [\webpack-preload], ->
  run-webpack [], true


gulp.task \webpack-watch, [\webpack-preload], ->
  run-webpack ['--watch']


gulp.task \webpack-preload, []


# ----- less ---------------------------------------------------------

run-less = (prod) ->
  gulp.src('src/*.less')
    .pipe $.plumber()
    .pipe $.less()
    .pipe $.if(prod, $.cssnano())


gulp.task \less, ->
  run-less()
    .pipe gulp.dest('dist')


gulp.task \less-prod, ->
  run-less(true)
    .pipe gulp.dest('dist')


gulp.task \less-watch, ->
  gulp.watch 'src/*.less', [\less]


# ----- jade ---------------------------------------------------------

gulp.task \jade, [\dotenv], -><commit_msg>feat(gulpfile): add preload task<commit_after>require! {
  fs
  child_process: {spawn}

  'prelude-ls': {union}
  'require-clean'

  gulp
  'gulp-util': gutil
  'run-sequence'
}

$ = require('gulp-load-plugins')()

# ----- bootstrap ----------------------------------------------------

console.error('[INFO] Checking `.env` file');
fs.statSync('.env');


# ----- webpack ------------------------------------------------------

run-webpack = (opt, prod) ->
  defaults = [
    '--colors'
    '--progress'
    '--display-chunks'
  ]
  opt = union opt, defaults


  message = if opt.length > 0
    "Run webpack with options `#{opt.join(' ')}`"
  else
    'Run webpack without options'

  message += ' with optimize' if prod
  gutil.log message

  process.env.WEBPACK_ENV = if prod then 'production' else 'development'
  spawn 'webpack', opt, stdio: 'inherit'


gulp.task \webpack, [\webpack-preload], ->
  run-webpack []


gulp.task \webpack-prod, [\webpack-preload], ->
  run-webpack [], true


gulp.task \webpack-watch, [\webpack-preload], ->
  run-webpack ['--watch']


gulp.task \webpack-preload, [\dotenv]


# ----- less ---------------------------------------------------------

run-less = (prod) ->
  gulp.src('src/*.less')
    .pipe $.plumber()
    .pipe $.less()
    .pipe $.if(prod, $.cssnano())


gulp.task \less, ->
  run-less()
    .pipe gulp.dest('dist')


gulp.task \less-prod, ->
  run-less(true)
    .pipe gulp.dest('dist')


gulp.task \less-watch, ->
  gulp.watch 'src/*.less', [\less]


# ----- jade ---------------------------------------------------------

gulp.task \jade, [\dotenv], ->
{'fraction_non_alphanumeric': 0.314070351758794, 'fraction_numerical': 0.000628140703517588, 'mean_word_length': 1.678721614802355, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 23, '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': '1715586', 'n_tokens_mistral': 1071, 'n_tokens_neox': 1038, 'n_words': 222}