Answer the question
In order to leave comments, you need to log in
How to configure Gulp to build and compile Less files?
There is a main file which contains imports of other less files.
The task is that when the data in the imported files changes, the main css file is collected and compiled.
Now everything happens in a strange way when you run Gulpa 1 time, everything is assembled as it should, on subsequent saves, the imported files retain their original appearance and changes in them do not affect the assembly of the main css file in any way. Whether they are somehow cached and do not pay attention to changes. To check, I delete the final css file, change the values in the imported less files, and save. I expect that the css file will be assembled with new values, and in fact the imported files in the final assembly have their original form.
What is the problem?
gulp.task('less', function () {
return gulp.src('resources/less/_imports.less')
.pipe(plumber({
errorHandler: notify.onError(
"ERROR:: <%= error.message %>")
}))
.pipe(less({
paths: [ path.join(__dirname, 'less', 'includes')]
}))
.pipe(rename('style.css'))
.pipe(gulp.dest('resources/css/'))
.pipe(connect.reload());
});
gulp.task('watch', function(){
gulp.watch('resources/less/**/*.less', ['less']);
})
gulp.task('default', ['connect', 'watch']);
Answer the question
In order to leave comments, you need to log in
I read that they are indeed cached, but now it's not clear how to turn it off.
The solution is to compile each file separately + concatenate. + setting order for a strict assembly sequence
- global variables are imported into each file in which they are used
- there is no need for a file with imports of other parts (blocks)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question