gulp-sass每次编译都会变慢



我有一个很简单的*。使用NPM和gulp4的SCSS编译任务。它由

监视
const scssWatcher = watch(['scss/*.scss']);
scssWatcher.on('all', function(event, path){ compileSass(path); });

而compileSass函数只是

gulp.src(path, {'base' : pathRoot + './scss'})
.pipe(sassInheritance({base: pathRoot + 'scss/'}))
.pipe(sass()).on('error', sass.logError)
.pipe(gulp.dest(pathRoot + 'css'));

sassInheritanceisgulp-better-sass-inheritance模块,它确保包含更新文件的所有文件也被更新。

它可以工作,但是每次编译都会变慢。
用这个监视器重新启动gulp任务是有效的,但是很麻烦。
我发现从管道中移除gulp-better-sass-inheritance可以解决问题。
我有这个工作与gulp 3没有问题。
有这个线程https://github.com/dlmanning/gulp-sass/issues/467与2016年相同的行为问题。

有人有同样的经历吗?任何帮助吗?

这些监视器和实时重新加载器充满了bug。使用shell自动重启即可。

while true; do
timeout 600 gulp run:live:watch whatever...
sleep 0.5
done

最新更新