gulp-sass slower with each compile

402 Views Asked by At

I have a very simple *.scss compilation task with the use of npm and gulp 4. It is watched by

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

And the compileSass function just

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

The sassInheritance is gulp-better-sass-inheritance module, which makes sure that all files that include the updated file are also updated.

It works, but get slower with every compile.
Restarting the gulp task with this watcher works but is cumbersome.
I have found out that removing the gulp-better-sass-inheritance from the pipeline solves the issue.
I have had this working with gulp 3 with no problem.
There is this thread https://github.com/dlmanning/gulp-sass/issues/467 with same behaving issue from 2016.

Anybody with the same experience? Any help?

1

There are 1 best solutions below

1
Ярослав Рахматуллин On

These watchers and live-re-loaders are full of bugs. Just restart it automatically using the shell.

while true; do

     timeout 600 gulp run:live:watch whatever...
     sleep 0.5
done