Skip to content

Commit fd68e13

Browse files
authored
Add note about Turbolinks compatibility.
1 parent 274f7ab commit fd68e13

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

README.md

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,26 @@ See the [BrowserSync API docs](http://www.browsersync.io/docs/api/) for initiali
4242
- The `app.use` statement must come before any handlers that you want to integrate with BrowserSync. This includes both dynamic route handlers and static asset handlers.
4343
- Injection only happens on responses with a `Content-Type` header of `text/html` and content containing a `</body>` or `</head>` tag.
4444

45-
## BrowserSync 1.x
45+
## Compatibility
46+
47+
### BrowserSync 1.x
4648

4749
If you need to use BrowserSync 1.x, use [version 1.0.2](https://github.com/schmich/connect-browser-sync/releases/tag/v1.0.2) of this package.
4850

51+
### Turbolinks
52+
53+
Turbolinks and BrowserSync can conflict (see [turbolinks#147](https://github.com/turbolinks/turbolinks/issues/147) and [browser-sync#977](https://github.com/BrowserSync/browser-sync/issues/977)). As a workaround, you can inject the BrowserSync tags into `<head>` instead.
54+
55+
To inject the tags into `<head>`, specify `{ injectHead: true }`:
56+
57+
```javascript
58+
if (app.get('env') === 'development') {
59+
var browserSync = require('browser-sync');
60+
var bs = browserSync.create().init({ logSnippet: false });
61+
app.use(require('connect-browser-sync')(bs, { injectHead: true }));
62+
}
63+
```
64+
4965
## Example
5066

5167
See the [example](example) folder.

0 commit comments

Comments
 (0)