Skip to content

Instantly share code, notes, and snippets.

@electblake
Last active August 30, 2015 15:21
Show Gist options
  • Select an option

  • Save electblake/6208e916ec78d07f09ed to your computer and use it in GitHub Desktop.

Select an option

Save electblake/6208e916ec78d07f09ed to your computer and use it in GitHub Desktop.
gulp nodemon and bunyan
// borrowed initial version from https://github.com/JacksonGariety/gulp-nodemon/issues/33
gulp.task('run', ['default', 'watch'], function() {
var nodemon = require('gulp-nodemon'),
spawn = require('child_process').spawn,
bunyan = require('bunyan');
nodemon({
script: paths.server,
ext: 'js json',
ignore: [
'var/',
'node_modules/'
],
watch: [paths.etc, paths.src],
stdout: false,
readable: false
})
.on('change', ['lint'])
.on('readable', function() {
// free memory
// bunyan && bunyan.kill()
bunyan = spawn('./node_modules/bunyan/bin/bunyan', [
'--output', 'short',
'--color'
])
bunyan.stdout.pipe(process.stdout)
bunyan.stderr.pipe(process.stderr)
this.stdout.pipe(bunyan.stdin)
this.stderr.pipe(bunyan.stdin)
});
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment