node.jsnpmgulpstyluswatchify

How to define a gulp task that initiates watchify and gulp-stylus?


I am trying to create a composite gulp task which runs 2 separate watch tasks at the same time:

gulp.task('watch-css', watchCssTask); // uses gulp-stylus
gulp.task('watch-js', watchJsTask);   // uses watchify (browserify)

What is the correct way to achieve the following with gulp?

gulp.task('watch', watchCssAndJsTask);

For instance, with vanilla npm tasks I would just do this:

"scripts": {
    "watch-css": ...
    "watch-js": ...
    "watch": "npm run watch-css && npm run watch-js",
}

Solution

  • The following seems to work:

    gulp.task('watch', [ 'watch-css', 'watch-js' ]);