永远运行gulp watch命令 [英] Run gulp watch command forever
本文介绍了永远运行gulp watch命令的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
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']);
这是我的gulp脚本代码。当我在终端中运行 gulp
时,它开始监视更改,自动编译sass文件,但是如果我关闭了终端窗口,它会停止监视。我也使用 gulp&
在后台运行它,但不工作,所以每当我在saas文件中创建chages时,自动编译它的正确方法是什么。
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.
推荐答案
我使用 nohup gulp&
它的工作完美。这是正确的做法吗?
I have make it run in the background with nohup gulp &
and it's working perfectly. Is it right way to do it?
这篇关于永远运行gulp watch命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文