var gulp = require('gulp'),
  eslint = require('gulp-eslint'),
  concat = require('gulp-concat'),
  uglify = require('gulp-uglify'),
  less = require('gulp-less'),
  cssmin = require('gulp-cssmin'),
  templateCache = require('gulp-angular-templatecache'),
  inject = require('gulp-inject'),
  webserver = require('gulp-webserver'),
  eventStream = require('event-stream'),
  rename = require('gulp-rename'),
  del = require('del'),
  paths = require('./gulp.config.json');

gulp.task('clean', function () {
  return del(paths.dist);
});

gulp.task('fonts', function () {
  return gulp.src(paths.fonts)
    .pipe(gulp.dest(paths.dist + 'fonts/'));
});

gulp.task('images', function () {
  return gulp.src(paths.images)
    .pipe(gulp.dest(paths.dist + 'images/'));
});

gulp.task('cssmin', function () {
  return gulp.src(paths.appLess)
    .pipe(less({
      'relative-urls': true
    }))
    .pipe(cssmin())
    .pipe(rename(paths.cssMinified))
    .pipe(gulp.dest(paths.dist));
});

gulp.task('jsmin', function () {
  var bowerComponents = gulp.src(paths.vendorJs),
    sources = gulp.src(paths.js),
    templates = gulp.src(paths.html)
      .pipe(templateCache('templates.js', {
        module: 'app',
        root: './'
      }));

  return eventStream.merge(bowerComponents, sources, templates)
    .pipe(concat(paths.jsMinified))
    .pipe(uglify())
    .pipe(gulp.dest(paths.dist));
});

gulp.task('create-app', ['jsmin', 'cssmin', 'fonts', 'images'], function () {
  var jsSrc = gulp.src(paths.dist + paths.jsMinified, {
    read: false
  });

  var cssSrc = gulp.src(paths.dist + paths.cssMinified, {
    read: false
  });

  return gulp.src(paths.app + 'index.html')
    .pipe(inject(jsSrc, {
      ignorePath: paths.dist.substring(1),
      addRootSlash: false
    }))
    .pipe(inject(cssSrc, {
      ignorePath: paths.dist.substring(1),
      addRootSlash: false
    }))
    .pipe(gulp.dest(paths.dist));
});

gulp.task('build', ['clean'], function () {
  return gulp.start('create-app');
});

gulp.task('css', function () {
  return gulp.src(paths.less)
    .pipe(less({
      'relative-urls': true
    }))
    .pipe(gulp.dest(paths.app));
});

gulp.task('lint', function () {
  return gulp.src(paths.js)
    .pipe(eslint())
    .pipe(eslint.format());
});

gulp.task('watch', ['lint'], function () {
  gulp.watch(paths.js, ['lint']);
  gulp.watch(paths.less, ['css']);
});

gulp.task('serve', ['watch'], function() {
  gulp.src(paths.app)
    .pipe(webserver({
      open: true
    }));
});
@@ -463,24 +463,550 @@
 ig.json');%0A%0A
+/*******************************************%5BMAIN TASKS%5D******************************************/%0A%0A/**%0A * Build optimized app%0A */%0Agulp.task('build', %5B'clean'%5D, function () %7B%0A  return gulp.start('create-app');%0A%7D);%0A%0A/**%0A * Serve dev environment with JS and less watcher%0A */%0Agulp.task('serve', %5B'watch'%5D, function() %7B%0A  gulp.src(paths.app)%0A    .pipe(webserver(%7B%0A      open: true%0A    %7D));%0A%7D);%0A%0A/******************************************%5BHELPER TASKS%5D*****************************************/%0A%0A/**%0A * Remove dist directory%0A */%0A
 gulp.task('c
@@ -1049,32 +1049,72 @@
 ths.dist);%0A%7D);%0A%0A
+/**%0A * Copy fonts to dist directory%0A */%0A
 gulp.task('fonts
@@ -1108,16 +1108,21 @@
 p.task('
+copy-
 fonts', 
@@ -1208,32 +1208,73 @@
 fonts/'));%0A%7D);%0A%0A
+/**%0A * Copy images to dist directory%0A */%0A
 gulp.task('image
@@ -1268,16 +1268,21 @@
 p.task('
+copy-
 images',
@@ -1371,32 +1371,72 @@
 mages/'));%0A%7D);%0A%0A
+/**%0A * Minify and bundle less files%0A */%0A
 gulp.task('cssmi
@@ -1627,32 +1627,70 @@
 hs.dist));%0A%7D);%0A%0A
+/**%0A * Minify and bundle JS files%0A */%0A
 gulp.task('jsmin
@@ -2076,32 +2076,64 @@
 hs.dist));%0A%7D);%0A%0A
+/**%0A * Create optimized app%0A */%0A
 gulp.task('creat
@@ -2161,16 +2161,21 @@
 smin', '
+copy-
 fonts', 
@@ -2175,16 +2175,21 @@
 onts', '
+copy-
 images'%5D
@@ -2658,91 +2658,206 @@
 );%0A%0A
-gulp.task('build', %5B'clean'%5D, function () %7B%0A  return gulp.start('create-app');%0A%7D);%0A
+/**%0A * Lint JS files using ESlint%0A */%0Agulp.task('lint', function () %7B%0A  return gulp.src(paths.js)%0A    .pipe(eslint())%0A    .pipe(eslint.format());%0A%7D);%0A%0A/**%0A * Compile less into css for dev server%0A */
 %0Agul
@@ -3009,120 +3009,41 @@
 );%0A%0A
-gulp.task('lint', function () %7B%0A  return gulp.src(paths.js)%0A    .pipe(eslint())%0A    .pipe(eslint.format());%0A%7D);%0A
+/**%0A * Watch JS and less file%0A */
 %0Agul
@@ -3158,122 +3158,4 @@
 %0A%7D);
-%0A%0Agulp.task('serve', %5B'watch'%5D, function() %7B%0A  gulp.src(paths.app)%0A    .pipe(webserver(%7B%0A      open: true%0A    %7D));%0A%7D);

add comments to gulpfile