简体   繁体   English

gulp-watch与无堵塞缓存问题相结合

[英]gulp-watch in combination with gulp-less caching issue

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). 任务'compile-less'构建我们的包少文件(包括所有@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. 第二次运行任务但是当我将某些内容更改为导入的较少文件时,我生成的dist文件夹不会更新。 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? 有没有人有同样的经历?

gulp-less version 4.0.0 has a strange caching issue. gulp-less version 4.0.0有一个奇怪的缓存问题。 Install gulp-less@3.5.0 and will solve the issue. 安装gulp-less@3.5.0并解决问题。 This will be fixed. 这将是固定的。 Check out https://github.com/stevelacy/gulp-less/issues/283#ref-issue-306992692 查看https://github.com/stevelacy/gulp-less/issues/283#ref-issue-306992692

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM