Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Getting BrowserSync and gulp-watch to play nicely
var browserSync = require('browser-sync'),
common = require('./__common__'),
gulp = require('gulp'),
watch = require('gulp-watch');
gulp.task('default', [
'less'
], function () {
browserSync({
server: {
baseDir: process.cwd()
},
port: 8000
});
watch([
common.files.css + '**/*',
common.files.img + '**/*',
common.files.js + '**/*',
common.files.html
], function (vinyl) {
browserSync.reload(vinyl.relative);
});
watch(common.files.less, function () {
gulp.start('less');
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment