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

How to use it with BrowserSync. #147

Closed
mrkongo opened this issue Jul 24, 2016 · 5 comments

Comments

@mrkongo
Copy link

commented Jul 24, 2016

I'm usiing BrowseSync for a project and it work good. But with turbolinks 5 I have this error:

Uncaught TypeError: Cannot read property 'querySelector' of nullt.SnapshotRenderer.n.findFirstAutofocusableElement @ turbolinks.self-c5acd7a….js?body=1:6t.SnapshotRenderer.n.focusFirstAutofocusableElement @ turbolinks.self-c5acd7a….js?body=1:6(anonymous function) @ turbolinks.self-c5acd7a….js?body=1:6t.Renderer.t.renderView @ turbolinks.self-c5acd7a….js?body=1:6t.SnapshotRenderer.n.render @ turbolinks.self-c5acd7a….js?body=1:6t.Renderer.t.render @ turbolinks.self-c5acd7a….js?body=1:6t.View.e.renderSnapshot @ turbolinks.self-c5acd7a….js?body=1:6t.View.e.render @ turbolinks.self-c5acd7a….js?body=1:6t.Controller.r.render @ turbolinks.self-c5acd7a….js?body=1:6(anonymous function) @ turbolinks.self-c5acd7a….js?body=1:6(anonymous function) @ turbolinks.self-c5acd7a….js?body=1:6
browser-sync-client.2.13.0.js:129 Uncaught TypeError: Cannot read property 'data1469402940180' of null

Here there is a issue on the browsersync's issues page:

BrowserSync/browser-sync#977

and as @mayke5421 suggests I can use that workaround for now, but when we can fix at all this problem?

And, for this workaround, it's still possible to use

<body data-no-turbolink="true">

with this new version of turbolinks?

@TSMMark

This comment has been minimized.

Copy link

commented Jul 26, 2016

I think they changed data-no-turbolink="true" to data-turbolinks="false".

@mrkongo

This comment has been minimized.

Copy link
Author

commented Jul 26, 2016

Ye but is there a fix for use both BrowserSync and Turbolinks?

@sstephenson

This comment has been minimized.

Copy link
Contributor

commented Jul 31, 2016

I’m afraid we don’t have the resources to debug specific compatibility issues with third-party libraries. You might want to try asking for help on Stack Overflow instead.

@maykefreitas

This comment has been minimized.

Copy link

commented Jul 31, 2016

Hey guys, I found a way to fix this issue. Browsersync injects a script in html page inside body tag, that causes the issue, so I changed some settings in Browsersync to inject script at head tag instead of body tag.

snippetOptions: {
      rule: {
        match: /<\/head>/i,
        fn: function (snippet, match) {
          return snippet + match;
        }
      }
    },

Hope that it can help someone :D

@mrkongo

This comment has been minimized.

Copy link
Author

commented Aug 1, 2016

The @maykefreitas solution works. For now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants
You can’t perform that action at this time.