diff --git a/Gulpfile.js b/Gulpfile.js index 6ecd75c..de1150e 100644 --- a/Gulpfile.js +++ b/Gulpfile.js @@ -23,7 +23,8 @@ gulp.task('afterstart', function (){ gulp.task('test', ['lint'], function () { var stream = nodemon({ - script: './test/server.js' + nodemon: require('nodemon') + , script: './test/server.js' , verbose: true , env : { 'NODE_ENV': 'development' diff --git a/index.js b/index.js index fa72d32..ce04754 100644 --- a/index.js +++ b/index.js @@ -1,6 +1,6 @@ 'use strict' -var nodemon = require('nodemon') +var nodemon , colors = require('colors') , gulp = require('gulp') , cp = require('child_process') @@ -9,6 +9,13 @@ var nodemon = require('nodemon') module.exports = function (options){ options = options || {}; + // plug nodemon + if (options.nodemon && typeof options.nodemon === 'function') { + nodemon = options.nodemon; + delete options.nodemon + } else + nodemon = require('nodemon'); + // Our script var script = nodemon(options) , originalOn = script.on @@ -96,7 +103,7 @@ module.exports = function (options){ return script // Synchronous alternative to gulp.run() - function run(tasks){ + function run(tasks) { if (typeof tasks === 'string') tasks = [tasks] if (tasks.length === 0) return if (!(tasks instanceof Array)) throw new Error('Expected task name or array but found: ' + tasks)