Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot disable browser-sync injection into iframe #553

Closed
tomgenoni opened this issue Apr 3, 2015 · 7 comments · May be fixed by tobybellwood/govstrap#4
Closed

Cannot disable browser-sync injection into iframe #553

tomgenoni opened this issue Apr 3, 2015 · 7 comments · May be fixed by tobybellwood/govstrap#4

Comments

@tomgenoni
Copy link

Ultimately, I am trying to prevent browser-sync (v2.5.2) from injecting into an iframe with a src of local content.

I've tried to disabled it completely with:

    gulp.task('browser-sync', function() {
      browserSync({
        snippetOptions: {
          rule: {
              match: /xxx/
          }
        },
        server: {
          baseDir: [__dirname] + '/_build/',
        }
      });
    });

I've also tried ignoring all files:

    gulp.task('browser-sync', function() {
      browserSync({
        snippetOptions: {
          ignorePaths: "*.html"
        },
        server: {
          baseDir: [__dirname] + '/_build/',
        }
      });
    });

But these don't work (also tried blacklist) and the snippet is injected to both the parent and iframe. Am I missing something?

@AlbertRAR
Copy link

Same problem, trying to figure it out. Please, let me know if you fix it.

@shakyShane
Copy link
Contributor

Please provide a minimal working example that highlights this bug.

@TexRx
Copy link

TexRx commented May 8, 2015

+1 Same problem here as well

@tomgenoni
Copy link
Author

Set up a repo that demos the problem. Make a change to the parent index.html and browser-sync is injected into both the parent and iframe. I'd like to iframe to be ignored by browser-sync.

https://github.com/tomgenoni/browser-sync-iframe

@shakyShane
Copy link
Contributor

@tomgenoni many thanks!

@shakyShane
Copy link
Contributor

@tomgenoni - there was an error in your original gulpfile. snippetOptions is a separate option, but you had it nested under the server property.

Either way, in your example, with the latest update (2.7.2), this will work as expected.

gulp.task('browser-sync', function () {
    browserSync({
        server: {
            baseDir: [__dirname] + '/dist/'
        },
        snippetOptions: {
            blacklist: ["/iframe/index.html"]
        }
    });
});

@tomgenoni
Copy link
Author

Thank you @shakyShane. I can confirm this works. I've updated my example repo to provide a working version: https://github.com/tomgenoni/browser-sync-block-iframe-example

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

Successfully merging a pull request may close this issue.

4 participants