Nodemon restart run gulp tasks

gulp, javascript, node.js

Solution

gulp-nodemon documentation states that you can do it directly, passing an array of tasks to execute:

nodemon({script: 'app.js'}).on('restart', ['scripts', 'lint']);

See doc here

UPDATE, as the author of gulp-nodemon uses run as well:

Idea #1, use functions:

var browserifier = function () {
  gulp.src(paths.browserify)
    .pipe(browserify())
    .pipe(gulp.dest('./build/js'))
    .pipe(refresh(server));
});

gulp.task('scripts', browserifier);

var linter = function () {
  gulp.src(paths.js)
    .pipe(jshint())
    .pipe(jshint.reporter(stylish));
});

gulp.task('lint', linter);

nodemon({script: 'app.js'}).on('restart', function(){
  linter();
  browserifier();
});

Problem

I have the following code in my gulpfile ``` gulp.task('scripts', function () { gulp.src(paths.browserify) .pipe(browserify()) .pipe(gulp.dest('./build/js')) .pipe(refresh(server)); }); gulp.task('lint', function () { gulp.src(paths.js) .pipe(jshint()) .pipe(jshint.reporter(stylish)); }); gulp.task('nodemon', function () { nodemon({ script: 'app.js' }); }); ``` I need to run the scripts and lint tasks when Nodemon restarts.I have the following ``` gulp.task('nodemon', function () { nodemon({ script: 'app.js' }).on('restart', function () { gulp.run(['scripts', 'lint']); }); }); ``` Gulp.run() is now deprecated, so how would I achieve the above using gulp and best practices?

Original source