gulp-watch in combination with gulp-less caching i

2019-01-15 22:31发布

I have the following setup:

// watch for changes
gulp.task('watch', function () {
  gulp.watch('./assets/**/*.less', ['compile-less']);
});

gulp.task("compile-less", () => {
    return gulp.src('./assets/build-packages/*.less')
    .pipe($.less({
        paths: [ $.path.join(__dirname, 'less', 'includes') ]
    }))
    .pipe(gulp.dest(OutputPath)); // ./dist/styles/
});

So basically every time a developer changes something in a less file it runs the task 'compile-less'. The task 'compile-less' builds our package less files (including all the @imports). The first change in a random less file works, all the less files are being build. The second time it runs the task but my generated dist folder isn't updated when I change something to a less file that is imported. I'm wondering if the combination of the watch task and the compiling task somehow caches files. Because if I run the compile-less task manually it works everytime.

Does anyone had the same experience?

1条回答
叛逆
2楼-- · 2019-01-15 22:44

gulp-less version 4.0.0 has a strange caching issue. Install gulp-less@3.5.0 and will solve the issue. This will be fixed. Check out https://github.com/stevelacy/gulp-less/issues/283#ref-issue-306992692

查看更多
登录 后发表回答