Skip to content
This repository has been archived by the owner on Sep 15, 2023. It is now read-only.

Fix Browsersync html task reload issue #306

Merged
merged 1 commit into from
Aug 1, 2016
Merged

Fix Browsersync html task reload issue #306

merged 1 commit into from
Aug 1, 2016

Conversation

mdmoreau
Copy link
Contributor

@mdmoreau mdmoreau commented Jul 8, 2016

Fixes #251
Only reload once at the end of the stream to keep browser from reloading too early

Fixes #251
Only reload once at the end of the stream to keep browser from reloading too early
@@ -37,7 +37,7 @@ var htmlTask = function() {
.on('error', handleErrors)
.pipe(gulpif(global.production, htmlmin(config.tasks.html.htmlmin)))
.pipe(gulp.dest(paths.dest))
.pipe(browserSync.stream())
.on('end', browserSync.reload)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How does this compare with doing

.pipe(browserSync.stream({once: true}));

as outlined in the docs?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It sounds like that should work based on the docs, but I haven't noticed any difference when trying that method. It doesn't seem to really matter until you have a lot of files or a longer nunjucks processing time, but once either of those are an issue using .on('end', browserSync.reload) is the only thing I've seen that consistently solves the problem. Discussed it a little bit in #251, and it didn't sound like anyone else had luck with stream: true either.

@greypants
Copy link
Contributor

Sounds good. Thanks for figuring that out!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants