Browsersync issue reload multipage html
See original GitHub issueI’m use jade and Browsersync in gulp to the generate html web page. When i run gulp Brwosersync can’t reload html file in the other directory(view.html). And i have to manualy reload browser. But for index.html in root folder work fine. how i can fix this issue?!
Folder structure:
- app
- index.html
- page
- view.html
// jade task
gulp.task('jade', function(){
return gulp.src(path.template+ '/**/*.jade')
.pipe($.plumber({errorHandler: onError}))
.pipe($.jade({
pretty: true
}))
.pipe(gulp.dest(path.app))
.pipe(reload({stream: true}));
});
// reload
gulp.task('bs-reload', function () {
browserSync.reload();
});
// browser-sync
gulp.task("browser-sync", function () {
browserSync.use(htmlInjector, {
files: "app/**/*.html"
});
browserSync.init({
injectChanges: true,
notify: false,
server: "app"
});
});
gulp.task('default',['browser-sync'], function(){
watch("src/template/**/*", function() { gulp.start('jade'); });
watch("app/**/*.html", function() { gulp.start('bs-reload'); });
});
Issue Analytics
- State:
- Created 8 years ago
- Reactions:1
- Comments:6 (1 by maintainers)
Top Results From Across the Web
Running multiple page error · Issue #2 · shrpne/penthouse ...
Reloads the browser whenever HTML or JS files change gulp.watch('app/.html', browserSync.reload); gulp.watch('app/js/.js', browserSync.reload);
Read more >javascript - Browser Sync multiple reloads - Stack Overflow
The problem is that in this task I ask Browser Sync to reload the server whenever I edit a slim file. Using again...
Read more >Browsersync options
Browsersync makes your browser testing workflow faster by synchronising URLs, interactions and code changes across multiple devices.
Read more >How to build a static website without frameworks using npm ...
Then I create the initial index.html in the root directory: ... For this, we'll add browser-sync, to auto-refresh the browser.
Read more >Gulp Browsersync causing multiple reloads with each ...
use only browserSync.stream (replace browserSync.reload then) and pass option once: true like this browserSync.stream({once: true}). this should works fine.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
+1.
Same issue here, the browsersync is not added to pages under subfolder, only on index.html
Thanks @shakyShane for reply. i clone this repo, and your repo has same issue 😃 Don’t reload browser when url somthing like this : http://localhost:3000/about.html Or this : http://localhost:3000/page/about.html.
And only reload index.html (localhost:3000).
My repo: Start-Gulp