I have a project where I'm using LESS as my CSS pre-processor and Gulp as my build tool. I have a folder structure as follows:
- stylesheets
- > less
- >> partials
- >>>_colours.less
- >> index.less
My index.less
file looks like this:
@import "partials/_colours";
.red { color: @colour; font-size: 12em; }
My _colours.less
file looks like this:
@colour: red;
And my gulpfile.js
looks like this (simplified, removed error handling)
var lessFiles = ['stylesheets/less/**/*.less', '!stylesheets/less/partials/*.less'];
gulp.task('less:compile', function() {
return gulp.src(lessFiles)
.pipe(sourcemaps.init())
.pipe(less())
.pipe(sourcemaps.write("maps", {includeContent: false, sourceRoot: '../less'}))
.pipe(gulp.dest('stylesheets'));
});
gulp.task('less:watch', ['less:compile'], function() {
return gulp.watch(lessFiles[0], ['less:compile']);
});
When I run gulp less:watch
everything compilles and I get an index.css
file (with source maps) in my stylesheets directory that I can take to Chrome and wire up for live editing.
If I edit the index.less
file in the Chrome editor and save, I get an instant reload. However, if I change the value of the @color
variable in _colours.less
I don't see the change until I reload the window.
Is this a bug or am I doing something wrong?
I'm using Chrome 43.