So my question is, is there a way that when I run gulp watch through my terminal my browser doesn't load on a new page but instead reloads on the present page?
You can for an option use the gulp-livereload
library:
npm install --save-dev gulp-livereload
gulp-livereload
will not automatically listen for changes. You now have to manually call livereload.listen
unless you set the option start:
livereload({ start: true })
Usage
:
var gulp = require('gulp'),
less = require('gulp-less'),
livereload = require('gulp-livereload');
gulp.task('less', function() {
gulp.src('less/*.less')
.pipe(less())
.pipe(gulp.dest('css'))
.pipe(livereload());
});
gulp.task('watch', function() {
livereload.listen();
gulp.watch('less/*.less', ['less']);
});