 gulp.task 'seed', shell.task 'node_modules/.bin/coffee ./config/seed.coffee'
 
 gulp.task 'watch', ->
+  gulp.watch(paths.src.app.coffee, ['app-coffee'])
+  gulp.watch(paths.src.app.jade, ['templates'])
+  gulp.watch(paths.src.assets.coffee, ['assets-coffee'])
   gulp.watch(paths.src.assets.less, ['less'])
-  gulp.watch(paths.src.assets.coffee, ['assets-coffee'])
-  gulp.watch(paths.src.app.coffee, ['app-coffee'])
-  gulp.watch(paths.src.app.coffee, ['templates'])
 
-gulp.task 'clean', ->
-  del('build')
+gulp.task 'clean', (cb) ->
+  del('build', cb)
 
-commonTasks = ['clean', 'css', 'js', 'less', 'img', 'assets-coffee']
+commonTasks = ['css', 'js', 'less', 'img', 'assets-coffee']
 
 gulp.task 'build', commonTasks.concat ['app-coffee', 'templates']
 

  .pipe(gulp.dest(paths.dest.app))
  cb()

gulp.task 'templates', ->
  gulp.src(paths.src.app.jade, base: '.')
  .pipe(gulp.dest(paths.dest.app))

gulp.task 'assets-coffee', ['assets-lint'], ->
  gulp.src(paths.src.assets.coffee)
  .pipe(coffee().on('error', gutil.log))
  .pipe(uglify())
  .pipe(concat('default.js'))
  .pipe(gulp.dest(paths.dest.js))

gulp.task 'js', ->
  gulp.src(paths.src.assets.js)
  .pipe(uglify())
  .pipe(concat('lib.js'))
  .pipe(gulp.dest(paths.dest.js))

gulp.task 'img', ->
  gulp.src(paths.src.assets.img)
  .pipe(gulp.dest(paths.dest.img))

gulp.task 'less', ->
  gulp.src(paths.src.assets.less)
  .pipe(sourcemaps.init())
  .pipe(less(paths: paths.bower)).on('error', gutil.log)

  .pipe(sourcemaps.write())
  .pipe(gulp.dest(paths.dest.css))

gulp.task 'css', ['clean'], ->
  gulp.src(paths.src.assets.css)
  .pipe(urlAdjuster(prepend: '/img/'))
  .pipe(prefix())
