For the life of me, I cannot somehow find what is wrong with this configuration! After injecting the master.css changes, instead of just reflecting the changes, my browser window automatically reloads although it says "injected". Could someone please help? I have a gulpfile.js with the following configuration:
var paths = {
master: {
styles: 'default/less/master.less',
},
watch: {
styles: 'default/less/**/*.less',
},
dist: {
styles: 'default/less',
}
};
Less Task:
gulp.task('less', function(){
'use strict';
gulp.src(paths.master.styles)
.pipe(sourcemaps.init())
.pipe(plumber())
.pipe(less({compress:false}))
.on('error', function (err) {
gutil.log(err);
this.emit('end');
})
.pipe(autoprefix())
.pipe(sourcemaps.write('../sourcemaps', {
includeContent: false, // Otherwise all the CSS would be included
sourceRoot: paths.dist.styles
}))
.pipe(gulp.dest(paths.dist.styles))
.on('error', gutil.log)
.pipe(browserSync.stream());
});
Browsersync Task:
gulp.task('browser-sync', ['less'], function() {
'use strict';
browserSync.init({
proxy: "http://mywebsite.local",
stream:true
});
gulp.watch(paths.watch.styles, ['less']);
});
And at the end:
gulp.task('default', ['less', 'browser-sync']);
I see a notification that the changes were injected, my terminal says master.css and master.css.map changed and my changes in the less file are reflected as well, but somehow the browser reloads which I don't want at all for the css compilation.