gulp-watch 结合 gulp-less 缓存问题 [英] gulp-watch in combination with gulp-less caching issue

查看:44
本文介绍了gulp-watch 结合 gulp-less 缓存问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下设置:

// 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/
});

因此,基本上每次开发人员更改较少文件中的某些内容时,它都会运行无编译"任务.'compile-less' 任务构建我们的无包文件(包括所有@imports).随机较少文件中的第一个更改有效,正在构建所有较少文件.它第二次运行任务,但是当我将某些内容更改为导入的 less 文件时,我生成的 dist 文件夹没有更新.我想知道监视任务和编译任务的组合是否会以某种方式缓存文件.因为如果我手动运行无编译任务,它每次都可以工作.

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.

有人有同样的经历吗?

推荐答案

gulp-less 4.0.0 版有一个奇怪的缓存问题.安装 gulp-less@3.5.0 即可解决问题.这将得到修复.查看 https://github.com/stevelacy/gulp-少/问题/283#ref-issue-306992692

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

这篇关于gulp-watch 结合 gulp-less 缓存问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆