Run gulp watch command forever

走远了吗. 提交于 2019-12-12 01:27:19

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!