require('babel-core/register');

var babel = require('gulp-babel');
var del = require('del');
var eslint = require('gulp-eslint');
var gulp = require('gulp');
var mocha = require('gulp-mocha');
var nodemon = require('gulp-nodemon');
var sourceMaps = require('gulp-sourcemaps');
var shell = require('gulp-shell');

// Starts the backend server
gulp.task('start:backend', ['build-backend', 'watch-backend']);

// Starts front-end dev server
gulp.task('start:frontend', shell.task([
  'node devServer.js'
]));

// Cleans out backend build
gulp.task('clean:backend', function(){
  return del([
    'api/build/**/*'
  ]);
});

// Transpiles ES6 to ES5 on backend
gulp.task('build-backend', ['clean:backend'], function(){
  return gulp.src([
    'api/**/*.js',
    '!api/build/**/*.js'
  ])
  .pipe(sourceMaps.init())
  .pipe(babel())
  .pipe(sourceMaps.write('.'))
  .pipe(gulp.dest('./api/build'));
});

// Starts Nodemon watch on backend
gulp.task('watch-backend', ['build-backend'], function(){
  nodemon({
    script: 'api/build/server.js',
    tasks: ['build-backend'],
    ignore: ['api/build', 'dist', 'spec'],
    ext: 'js'
  });
});

// Runs mocha tests in /spec folder
gulp.task('test', function(){
  return gulp.src([
    'spec/**/*.js'
  ],{ read: false })
  .pipe(mocha({ report: 'nyan' }));
});

// Runs Lint on project (frontend & backend)
gulp.task('vet', function(d){
  return gulp.src([
    '**/*.js',
    '!node_modules/**',
    '!api/build/**',
    '!dist/**'
    ])
    .pipe(eslint())
    .pipe(eslint.format())
    .pipe(eslint.failAfterError());
});
@@ -305,16 +305,50 @@
 shell');
+%0Avar webpack = require('webpack');
 %0A%0A// Sta
@@ -353,28 +353,21 @@
 tart
-s the b
+ B
 ackend 
-server
+Task
 %0Agul
@@ -389,33 +389,33 @@
 ackend', %5B'build
--
+:
 backend', 'watch
@@ -435,132 +435,26 @@
 %0A// 
-Starts front-end dev server%0Agulp.task('start:frontend', shell.task(%5B%0A  'node devServer.js'%0A%5D));%0A%0A// Cleans out b
+Clean B
 ackend 
-build
+Task
 %0Agul
@@ -543,40 +543,26 @@
 %0A// 
-Transpiles ES6 to ES5 on b
+Build B
 ackend
+ Task
 %0Agul
@@ -570,25 +570,25 @@
 .task('build
--
+:
 backend', %5B'
@@ -807,39 +807,32 @@
 %0A// 
-Starts Nodemon w
+Run & W
 atch 
-on b
+B
 ackend
+ Task
 %0Agul
@@ -854,33 +854,33 @@
 ackend', %5B'build
--
+:
 backend'%5D, funct
@@ -951,17 +951,17 @@
  %5B'build
--
+:
 backend'
@@ -1038,40 +1038,467 @@
 %0A// 
-Runs mocha tests in /spec folder
+Start Frontend Task%0Agulp.task('start:frontend', shell.task(%5B%0A  'node devServer.js'%0A%5D));%0A%0A// Build Frontend Task%0Agulp.task('build:frontend', function(done)%7B%0A  var webpackConfig = require('./webpack.config.' + (process.env.NODE_ENV === 'production' ? 'prod' : 'dev' ));%0A  webpack(webpackConfig, function(err, stats)%7B%0A    if(err) %7B%0A      console.log('Error', err);%0A    %7D else %7B%0A      console.log(stats.toString());%0A    %7D%0A    done();%0A  %7D);%0A%7D);%0A%0A%0A// Run Tests Task
 %0Agul
@@ -1632,49 +1632,32 @@
 %0A// 
-Runs Lint on project (frontend & backend)
+Lint entire project Task
 %0Agul
@@ -1867,12 +1867,13 @@
 rror());%0A%7D);
+%0A

Add frontend build task to gulp