-
-
Save devopsmariocom/419d399001875f80173b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var gulp = require('gulp'), | |
spawn = require('child_process').spawn, | |
node; | |
var startServer = function() { | |
if (node) node.kill() | |
node = spawn('node', ['--harmony', 'index.js'], { | |
stdio: 'inherit' | |
}) | |
node.on('close', function(code) { | |
if (code === 8) { | |
gulp.log('Error detected, waiting for changes...'); | |
} | |
}); | |
}; | |
/** | |
* $ gulp server | |
* description: launch the server. If there's a server already running, kill it. | |
*/ | |
gulp.task('server', function() { | |
startServer(); | |
}); | |
/** | |
* $ gulp | |
* description: start the development environment | |
*/ | |
gulp.task('default', function() { | |
startServer(); | |
gulp.watch(['./index.js', '**/*.js', '../lib/*.js'], ['server']) | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment