const gulp = require('gulp');
const config = require('../config.js');
const plugins = require('gulp-load-plugins')();
const spawn = require('child_process').spawn;

gulp.task('livereload', function () {
    plugins.livereload.listen(config.livereloadPort);

    return gulp.watch(config.livereloadPaths)
        .on('change', plugins.livereload.changed);
});

gulp.task('watcher', function () {
    gulp.watch(config.watchScripts, ["scripts:watch"]);
    gulp.watch(config.watchStyles, ["styles"]);
    gulp.watch(config.watchImages, ["images"]);
    gulp.watch(config.watchIcons, ["icons"]);
    gulp.watch(config.watchFonts, ["copy"]);
    gulp.watch(config.watchHtml, ["html"]);
    gulp.start("fractal");

    return;
});

gulp.task('watch', function () {
    var watchNode;
    var livereloadNode;
    var isWin = /^win/.test(process.platform);
    var gulpSpawnProcessName = isWin ? 'gulp.cmd' : 'gulp';

    gulp.watch(config.projectPath + 'gulp/config.js', spawnChildren);
    spawnChildren();

    function spawnChildren() {
        if (watchNode) { watchNode.kill(); }
        watchNode = spawn(gulpSpawnProcessName, ['watcher'], { stdio: 'inherit' });

        if (!livereloadNode) {
            livereloadNode = spawn(gulpSpawnProcessName, ['livereload'], { stdio: 'inherit' });
        } else {
            gulp.watch(config.livereloadPaths)
                .on('change', plugins.livereload.changed);
        }
    }
});

// Setup 'gulp w' shorthand
gulp.task('w', function () {
    return gulp.start('watch');
});

@@ -369,18 +369,16 @@
 k('watch
-er
 ', funct
@@ -676,35 +676,8 @@
 %22%5D);
-%0A    gulp.start(%22fractal%22);
 %0A%0A  
@@ -687,24 +687,27 @@
 eturn;%0A%7D);%0A%0A
+// 
 gulp.task('w
@@ -702,32 +702,34 @@
 gulp.task('watch
+er
 ', function () %7B
@@ -725,24 +725,27 @@
 nction () %7B%0A
+// 
     var watc
@@ -747,24 +747,27 @@
  watchNode;%0A
+// 
     var live
@@ -778,16 +778,19 @@
 adNode;%0A
+// 
     var 
@@ -828,20 +828,23 @@
 tform);%0A
+//
     
+ 
 var gulp
@@ -892,16 +892,19 @@
 gulp';%0A%0A
+// 
     gulp
@@ -965,19 +965,25 @@
 ldren);%0A
+//
    
+  //
  spawnCh
@@ -989,24 +989,27 @@
 hildren();%0A%0A
+// 
     function
@@ -1023,24 +1023,27 @@
 hildren() %7B%0A
+// 
         if (
@@ -1075,16 +1075,19 @@
 ll(); %7D%0A
+// 
         
@@ -1159,24 +1159,27 @@
 herit' %7D);%0A%0A
+// 
         if (
@@ -1193,24 +1193,27 @@
 loadNode) %7B%0A
+// 
             
@@ -1296,16 +1296,19 @@
 it' %7D);%0A
+// 
         
@@ -1316,16 +1316,19 @@
  else %7B%0A
+// 
         
@@ -1358,32 +1358,34 @@
 ivereloadPaths)%0A
+//
                 
@@ -1376,32 +1376,33 @@
                 
+ 
 .on('change', pl
@@ -1428,16 +1428,19 @@
 anged);%0A
+// 
         
@@ -1441,22 +1441,28 @@
       %7D%0A
+//
     
+ 
 %7D%0A
+// 
 %7D);%0A%0A// 
@@ -1500,16 +1500,29 @@
 ask('w',
+ %5B'default'%5D,
  functio

Update watch