{"id":16519952,"url":"https://github.com/schmich/connect-browser-sync","last_synced_at":"2025-03-21T09:30:29.804Z","repository":{"id":13896981,"uuid":"16595441","full_name":"schmich/connect-browser-sync","owner":"schmich","description":"Connect middleware for BrowserSync","archived":false,"fork":false,"pushed_at":"2022-03-30T19:42:30.000Z","size":28,"stargazers_count":16,"open_issues_count":0,"forks_count":7,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-17T23:37:40.918Z","etag":null,"topics":["browser-sync","browsersync","connect","express","javascript","middleware","server"],"latest_commit_sha":null,"homepage":"https://www.npmjs.org/package/connect-browser-sync","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/schmich.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-02-06T21:58:35.000Z","updated_at":"2021-03-06T23:18:04.000Z","dependencies_parsed_at":"2022-09-15T18:40:42.386Z","dependency_job_id":null,"html_url":"https://github.com/schmich/connect-browser-sync","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/schmich%2Fconnect-browser-sync","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/schmich%2Fconnect-browser-sync/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/schmich%2Fconnect-browser-sync/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/schmich%2Fconnect-browser-sync/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/schmich","download_url":"https://codeload.github.com/schmich/connect-browser-sync/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244771309,"owners_count":20507788,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["browser-sync","browsersync","connect","express","javascript","middleware","server"],"created_at":"2024-10-11T16:49:00.682Z","updated_at":"2025-03-21T09:30:29.521Z","avatar_url":"https://github.com/schmich.png","language":"JavaScript","readme":"# connect-browser-sync\n\n[Connect](https://github.com/senchalabs/connect) middleware for [BrowserSync](https://github.com/shakyShane/browser-sync).\n\nUse this middleware to automatically inject the necessary BrowserSync `\u003cscript\u003e` tags into your HTML pages. Alternatively, you can integrate BrowserSync with your app using [Gulp](https://github.com/shakyShane/gulp-browser-sync) or [Grunt](https://github.com/shakyShane/grunt-browser-sync).\n\n[![NPM version](https://badge.fury.io/js/connect-browser-sync.svg)](https://npmjs.org/package/connect-browser-sync)\n[![Build Status](https://travis-ci.org/schmich/connect-browser-sync.svg?branch=master)](https://travis-ci.org/schmich/connect-browser-sync)\n\n## Usage\n\nAssuming you will only use BrowserSync in development:\n\n```\nnpm install browser-sync --save-dev\nnpm install connect-browser-sync --save-dev\n```\n\n```javascript\n// app.js\nvar express = require('express');\nvar app = express();\n\n// Other configuration...\n\nif (app.get('env') === 'development') {\n  var browserSync = require('browser-sync');\n  var bs = browserSync.create().init({ logSnippet: false });\n  app.use(require('connect-browser-sync')(bs));\n}\n\n\n// Routes and handlers...\n```\n\nSee the [BrowserSync API docs](http://www.browsersync.io/docs/api/) for initialization options.\n\n## Notes\n\n- You must use version 2.0.0 or greater of the `browser-sync` package.\n- 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.\n- Injection only happens on responses with a `Content-Type` header of `text/html` and content containing a `\u003c/body\u003e` or `\u003c/head\u003e` tag.\n\n## Compatibility\n\n### BrowserSync 1.x\n\nIf 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.\n\n### Turbolinks\n\nTurbolinks 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 `\u003chead\u003e` instead.\n\nTo inject the tags into `\u003chead\u003e`, specify `{ injectHead: true }`:\n\n```javascript\nif (app.get('env') === 'development') {\n  var browserSync = require('browser-sync');\n  var bs = browserSync.create().init({ logSnippet: false });\n  app.use(require('connect-browser-sync')(bs, { injectHead: true }));\n}\n```\n\n## Example\n\nSee the [example](example) folder.\n\n## License\n\nCopyright \u0026copy; 2014 Chris Schmich\n\u003cbr\u003e\nMIT License, See [LICENSE](LICENSE) for details.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fschmich%2Fconnect-browser-sync","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fschmich%2Fconnect-browser-sync","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fschmich%2Fconnect-browser-sync/lists"}