Connect middleware that automatically injects BrowserSync script tags into responses. Version 2.1.0 supports BrowserSync >=2.0.0, with an optional Turbolinks workaround. Released 2015, no recent updates. Compared to Gulp/Grunt plugins, this integrates directly with Connect/Express middleware stack.
npm install connect-browser-syncVerified import paths — ran on the pinned version, not inferred.
Shows how to set up connect-browser-sync with Express in development mode, injecting BrowserSync scripts.
Ensure app.use(require('connect-browser-sync')(bs)) appears before app.use(express.static(...)) and route definitions.Upgrade both packages: npm install browser-sync@latest connect-browser-sync@latest
Evaluate if package is still functional with your BrowserSync version; test thoroughly.
Ensure your HTML responses have proper doctype and closing body/head tags.
Pass second argument: app.use(require('connect-browser-sync')(bs, { injectHead: true }));var bs = browserSync.create().init({ logSnippet: false }); app.use(require('connect-browser-sync')(bs));app.use(require('connect-browser-sync')(bs));Move middleware before all routes. Check Content-Type header.
npm install browser-sync --save-dev