Skip to content

Commit

Permalink
Merge pull request #33 from jr-cologne/fix-bug#31
Browse files Browse the repository at this point in the history
Fix infinite reloading bug of browser by browser-sync
  • Loading branch information
jr-cologne authored Dec 27, 2018
2 parents b900bff + 2b0c812 commit 1656f11
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,12 @@ gulp.task('serve', () => {
});
});

gulp.task('reload', () => {
return browserSync.reload({
stream: true
});
});

gulp.task('watch', () => {
let watch = [
src_folder + '_config.yml',
Expand All @@ -152,14 +158,15 @@ gulp.task('watch', () => {
src_assets_folder + 'sass/**/*.sass',
src_assets_folder + 'js/**/*.js',
'!' + dist_folder + '**/*.*',
'!' + node_modules_folder + '**/*.*'
'!' + node_modules_folder + '**/*.*',
'!' + src_assets_folder + 'vendor/**/*.*'
];

node_dependencies.forEach(dependency => {
watch.push(node_modules_folder + dependency + '/**/*.*');
});

gulp.watch(watch, gulp.series('build')).on('change', browserSync.reload);
gulp.watch(watch, gulp.series('build', 'reload'));
});

gulp.task('default', gulp.series('build', gulp.parallel('serve', 'watch')));

0 comments on commit 1656f11

Please sign in to comment.