 errorHandler = (e) ->
   gutil.log e
   gutil.beep()
-  console.log "Hey, dude"
   return true
 
 watchHelper = (pattern, task) ->

  watchHelper "style/*.styl", "stylus"
  watchHelper "lib/*.coffee", "browserify"
  watchHelper "lib/*.coffeex", "browserify"
  watchHelper ["lib/*.js", "etc/*", "dist/*.js", "!dist/bundle.js"], "browserify"

gulp.task "clean", ->
  gulp.src(["dist/**/*.*", "style/appbooking.css"], read: false)
  .pipe clean()

gulp.task "default", ["build"], ->


gulp.task "browserify", ["coffee", "coffeex"], ->
  gulp.src("./dist/lib/lunchtime.js", read: false)
  .pipe(browserify({debug: true}))
  .on("error", errorHandler)
  .pipe(rename("bundle.js"))
  .pipe gulp.dest("./dist/lib")
