 fs          = require 'fs'
 underscore  = require 'underscore'
 
-# Create the prerequisites for the actual
-# app and the app itself
+# Create the prerequisites for the actual app
+# 
+# depends on:
+#   vendor
+#   app
 gulp.task 'scripts', ['vendor', 'app']
 
+# vendor task - retrieves the dependencies from the bower
+# definition and concatenates then onto vendor.js
 gulp.task 'vendor', ->
   bowerFile = require './bower.json'
   bowerDir = './client/lib'

    .pipe plumber()
    .pipe gulp.dest 'dist/static/css/fonts'

gulp.task 'watch', ->
  gulp.watch "src/scss/*.scss", ['sass']
  gulp.watch "src/javascript/**/*.js", ['scripts', 'lint']
  gulp.watch "src/index.html", ['minify-html']
  gulp.watch "src/partials/*.html", ['minify-partials']
  gulp.watch 'src/img/**/*', ['images']


# Remove generated sources
gulp.task 'clean', ->

    .pipe concat('vendor.js')
    .pipe gulp.dest 'dist/static/js'

# app task - concatenates all application code into app.js
gulp.task 'app', ->
  gulp.src ['src/javascript/app.js', 'src/javascript/directives/*.js', 'src/javascript/services/*.js', 'src/javascript/controllers/*.js']
    .pipe plumber()
