gulpfile.js
function scripts (src, dest, watch) {
  var bundleOpts = _.extend({}, watchify.args)
  if (watch) bundleOpts.debug = true

  var bundle = browserify(src, bundleOpts)

  if (watch) {
    bundle = watchify(bundle)

    bundle.on('update', function () { compileBundle(bundle, dest) }) // when a dependency changes, recompile
    bundle.on('log', gutil.log) // output build logs to terminal
  } else {
    bundle.transform({ global: true }, 'uglifyify')
  }

  return compileBundle(bundle, dest)
}
function scripts (src, dest, watch) {
  var bundleOpts = _.extend({}, watchify.args)
  if (watch) bundleOpts.debug = true

  var bundle = browserify(src, bundleOpts)

  if (watch) {
    bundle = watchify(bundle)

    bundle.on('update', function () { compileBundle(bundle, dest) }) // when a dependency changes, recompile
    bundle.on('log', gutil.log) // output build logs to terminal
  } else {
    bundle.transform({ global: true }, 'uglifyify')
  }

  return compileBundle(bundle, dest)
}
function scripts ( src , dest , watch ) { var bundleOpts = _ . extend ( { } , watchify . args ) if ( watch ) bundleOpts . debug = true var bundle = browserify ( src , bundleOpts ) if ( watch ) { bundle = watchify ( bundle ) bundle . on ( 'update' , function ( ) { compileBundle ( bundle , dest ) } ) // when a dependency changes, recompile bundle . on ( 'log' , gutil . log ) // output build logs to terminal } else { bundle . transform ( { global : true } , 'uglifyify' ) } return compileBundle ( bundle , dest ) }
Build scripts and optionally watch for changes
Build scripts and optionally watch for changes