问题
gulp.task('css', function () {
gulp.src('custom_css/sass/style.scss')
.pipe(sass({
style: 'compressed'
}))
.pipe(gulp.dest('./public/css/'));
});
gulp.task('watch', function() {
gulp.watch('custom_css/sass/style.scss', ['css']);
});
gulp.task('default', ['css','watch']);
this is my gulp script code. when I run gulp
in the terminal it start watching for changes, auto compile sass file, but it stop watching if I closed the terminal window. I have also used gulp &
to run it in background but not working so what is the proper way to auto compile it every time when I am make chages in the saas file.
回答1:
I have make it run in the background with nohup gulp &
and it's working perfectly. Is it right way to do it?
回答2:
Not not sure why you would want to run gulp forever. It is not meant to be used that way. However, check out forever.js.
来源:https://stackoverflow.com/questions/33580035/run-gulp-watch-command-forever