Skip to content

Instantly share code, notes, and snippets.

@frankdejonge
Created May 27, 2014 12:18
Show Gist options
  • Save frankdejonge/92593dd3e208920471eb to your computer and use it in GitHub Desktop.
Save frankdejonge/92593dd3e208920471eb to your computer and use it in GitHub Desktop.
Watched Gulpfile.js
var gulp = require('gulp');
var spawn = require('child_process').spawn;
var subprocess;
function refreshGulpfile() {
if (subprocess) subprocess.kill();
subprocess = spawn('gulp', ['watched-default'], {stdio: 'inherit'});
}
gulp.task('default', function () {
refreshGulpfile();
gulp.watch('gulpfile.js', refreshGulpfile);
});
gulp.task('watched-default', function () {
// Put normal default stuff in here!
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment