I am using the following folder structure:
css
|_ main.css
|
|_ less
|_ main.less
|_ sub.less
|
|_ shared
|_ variables.less
|_ header.less
|_ footer.less
I am using the following in my gulpfile.js
gulp.task('less', function() {
gulp.src(paths.less + 'main.less', {read: true})
.pipe(plugins.plumber({errorHandler: onError}))
.pipe(plugins.less({
paths: [paths.less + 'shared', paths.less]
}))
.pipe(plugins.plumber.stop())
.pipe(gulp.dest(paths.css));
});
...
gulp.task('less:watch', function(){
gulp.watch([paths.less + '**/*.less'], ['less']);
});
gulp.task('default', ['less', 'less:watch']);
My main.less includes @imports for all the other LESS files.
@import "sub.less";
@import "./shared/variables.less";
@import "./shared/header.less";
@import "./shared/footer.less";
If a LESS file (other than main.less) is updated the file main.css does not change.
If main.less is updated (needed after any other LESS file change), main.css then updates.
How can I modify my gulpfile.js to update the "main.css" file regardless of which LESS file is changed?
Thank you.