Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
168 views
in Technique[技术] by (71.8m points)

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). 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?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...