gulp-watch in combination with gulp-less caching issue

孤街浪徒 提交于 2019-12-17 21:16:09

问题


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:


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



来源:https://stackoverflow.com/questions/49132742/gulp-watch-in-combination-with-gulp-less-caching-issue

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