/**
 * nodemon.js
 * @name - "nodemon"
 * @task - Set up live-reloading via browserSync
 */


var gulp   = require("gulp"),
    nodemon = require("gulp-nodemon"),
    browserSync = require("browser-sync"),
    config = require("../config").server;

gulp.task("nodemon", function (cb) {
  if(config.runServer){
    var called = false;
    return nodemon({
      script: config.file,
      watch: ["app.js"]
    })
    .on("start", function() {
      /** Make sure starting callback is only triggered once */
      if (!called) {
        cb();
      }
      called = true;
    })
    .on("restart", function() {
      /** reload connected browsers after a slight delay */
      setTimeout(function() {
        browserSync.reload({
          stream: false
        });
      }, config.reloadDelay);
    });
  }
  else {
    /** Signalize task is done when no server is setup */
    cb();
  }
});

@@ -81,16 +81,140 @@
 serSync%0A
+ * Nodemon task inspired by https://github.com/sogko/gulp-recipes/tree/master/browser-sync-nodemon-expressjs %C2%A9 Hafiz Ismail%0A
  */%0A%0A%0Ava
@@ -517,16 +517,19 @@
 h: %5B
-%22app.js%22
+config.file
 %5D%0A  

Add credit for nodemon-task