question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Browsersync issue reload multipage html

See original GitHub issue

I’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:open
  • Created 8 years ago
  • Reactions:1
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
vhlongoncommented, Feb 10, 2016

+1.

Same issue here, the browsersync is not added to pages under subfolder, only on index.html

1reaction
sajadabedicommented, Jul 17, 2015

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

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found