shakyShane / html-injector

BrowserSync html injector
78 stars 21 forks source link

Not working properly #26

Closed spcheema closed 7 months ago

spcheema commented 7 years ago

Hi All,

I've setup gulp project to inject html as stream instead of full page reload. But, I'm still getting full page reload. Here is my gulp code.

var gulp = require('gulp');
var browserSync = require('browser-sync').create();
var htmlInjector = require("bs-html-injector");

gulp.task('serve', function(){

   browserSync.use(htmlInjector, {
      files: "./app/**/*.html"
   });

    browserSync.init({
       server: {
        baseDir: "./app/"
       },
       browser: "chrome",
       open: false
    });
});

gulp.task('default', ['serve'],function() {
   console.log('Web ui');
   gulp.watch("./app/**/*.html", htmlInjector);
});

This is angular1.5 app and I've index.html under app directory and templates inside sub directories under app directory. Whenever, I make any change html file, browser refresh whole page rather injecting changes.

Ravenstine commented 7 years ago

Try omitting gulp.watch("./app/**/*.html", htmlInjector);. I know the example in the README has the same thing, but removing that gives me the desired result(live HTML injection without page reloads).

ijy commented 6 years ago

Did you manage to fix the issue? I'm experiencing the same issue with the same setup.

chrisblossom commented 6 years ago

@ijy did you try @Ravenstine's suggestion? That should fix it.