Y
Y
Yunique2018-06-10 14:56:27
gulp.js
Yunique, 2018-06-10 14:56:27

How to specify multiple directories in browsersync?

I decided to try to master browsersync. But I can't make it so that two files are updated in different directories, for example /index.html and css/main.css. How to register in watch that would simultaneously track changes in the file at the root and in the file in the folder.
Worth gulp
const gulp = require('gulp');
const browserSync = require('browser-sync').create();
const reload = browserSync.reload;
gulp.task('server', function() {
browserSync.init({
server: {
port: 9000,
baseDir: "source"
}
});
gulp.watch("source/!**!/!*"). on('change', reload);
});
Thank you in advance for your response.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
Ihor Bratukh, 2018-06-10
@Yunique33

browserSync.watch('./source/**/*.*').on('change', browserSync.reload);

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question