Skip to content

Browsersync for Turbolinks

Mayke edited this page Jul 27, 2017 · 1 revision

In order to support Turbolinks, Browsersync can be used with a custom rule to include Browsersync's script at the <head> tag instead of the <body> tag.

See the example below:

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

With this configuration Browsersync will work fine with Turbolinks.

Based on https://github.com/BrowserSync/browser-sync/issues/977#issuecomment-236443965