Devb
Devb

Reputation: 471

npm run multiple scripts (node app.js & gulp watch)

I would like to run app.js & gulp watch in a single command, however when I run npm run watch, the terminal stop on listen to port 3000, my gulp watch are not executed.

Below are my files:

packaga.json

"scripts": {
    "watch": "node app.js & gulp watch"
  }

app.js

var express = require('express');
var app = express();
app.use(express.static(__dirname + '/build'));
app.listen(3000);
console.log('listen to port 3000');

gulpfile.js

gulp.task('watch', function(){
  gulp.watch('./src/*.scss', gulp.series(['styles', 'css'])); 
})

Upvotes: 0

Views: 163

Answers (1)

knrf
knrf

Reputation: 89

"node app.js && gulp watch": This runs the express server, then the gulp command. As long as your server is running the gulp won't be executed I guess. Maybe take a look at this page: Starting an express server from within gulp

Upvotes: 1

Related Questions