-
Notifications
You must be signed in to change notification settings - Fork 752
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Multiple files changed = multiple reloads. Global debounce? #329
Comments
Ah, I just found #134 and that's actually better! I excluded var gulp = require('gulp');
var browserSync = require('browser-sync');
var dest = './dist';
gulp.task('browserSync', function() {
browserSync({
files: [
dest + '/**',
'!' + dest + '/**/*.html'
]
});
});
gulp.task('watch', ['browserSync'], function() {
gulp.watch(config.markup.src, ['html', browserSync.reload]);
}); I was afraid I would have to |
Actually, this has become an issue again since I started using BS from the command-line. I googled for a solution and ended up back on this issue :D |
Small sample project highlighting the issue? :) |
@bfred-it Any updates? |
This is a sample project that simulates the behavior with gulp while launching BS from CLI: Keep in mind that I wouldn't be able to solve the issue it like I did in my second post (i.e. within gulp itself) gulp # in separate window
browser-sync start --server --files "dist/*.html" --startPath "dist/a.html" Demo. Notice how the timestamp changes 3 times |
@bfred-it - thanks! File watching is undergoing a rewrite currently so we'll make sure this is fixed also :) |
Woot! |
|
hey my browsersync is reloading every 43 ms, its impossible to work , some help? |
My gulp workflow sometimes will yield multiple html files (e.g. I change a Jade partial and 3 dependent files are regenerated) within 1-2 seconds. This cause BS to reload as many times as the number of files, sometimes actually missing the last one (incidentally exactly the one I have open in the browser).
Is there a way to debounce these refreshes? Ideally it should happen either:
_.debounce(refresh, 1000)
, a second after the last file changes, or_.debounce(refresh, 1000, {leading:true})
, as soon as the first file changes and a second after the last file changesThe text was updated successfully, but these errors were encountered: