shakyShane/browser-sync — pull request #372 by mahnunchik (2014-12-18 09:41:39+00:00)
Title: allow to inject browser-sync client.js in custom middlewares

This small fix allows us to use any type of express/connect middlewares and does not break insertion browser-sync script.

Releted issue: https://github.com/shakyShane/browser-sync/issues/217

My use case:
```js
gulp.task('browser-sync', function() {
var browserSync = require('browser-sync');
var app = require('express')();

app.set('view engine', 'jade');
app.use(require('./mycustomrouter'));
// file: mycustomrouter.js
//var router = require('express').Router();
//router.route('/my/custom/route')
// .get(function(req, res) {
// res.render('template_name', {data: customLocals);
// });

module.exports = router;

browserSync({
startPath: '/my/custom/route',
server: {
baseDir: './dist',
middleware: app
}
});
});
```

This fix allow us to use `browser-sync` withous any script-injection hacks=)