Skip to content

Commit e2db48b

Browse files
committed
Closes #6
1 parent 68c6fc7 commit e2db48b

File tree

3 files changed

+12
-12
lines changed

3 files changed

+12
-12
lines changed

index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ module.exports = function injectBrowserSync(browserSync) {
1313
return injector(function(req, res) {
1414
var contentType = res.getHeader('content-type');
1515
return contentType && (contentType.toLowerCase().indexOf('text/html') >= 0);
16-
}, function(callback, content, req, res) {
16+
}, function converter(content, req, res, callback) {
1717
function inject() {
1818
var lastBody = /<\s*\/\s*body\s*>(?!(.|\n)*<\s*\/\s*body\s*>)/gi;
1919
var injected = content.toString().replace(lastBody, snippet + '</body>');
@@ -24,7 +24,7 @@ module.exports = function injectBrowserSync(browserSync) {
2424
// We don't have the snippet from BrowserSync yet.
2525
// Block the response until we get it.
2626
browserSync.events.on('init', function(config) {
27-
snippet = config.api.snippet;
27+
snippet = config.options.snippet;
2828
inject();
2929
});
3030
} else {

package.json

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
{
22
"name": "connect-browser-sync",
3-
"version": "1.0.1",
3+
"version": "1.0.2",
44
"description": "Connect middleware for BrowserSync.",
55
"main": "index.js",
66
"scripts": {
77
"test": "node test/test.js"
88
},
99
"dependencies": {
10-
"connect-injector": "~0.2.3"
10+
"connect-injector": "~0.4.0"
1111
},
1212
"devDependencies": {
13-
"gulp": "~3.5.2",
14-
"gulp-util": "~2.2.14",
15-
"shelljs": "~0.2.6",
16-
"inquirer": "~0.4.1",
17-
"connect": "~2.13.0",
18-
"request": "~2.34.0",
13+
"gulp": "~3.8.8",
14+
"gulp-util": "~3.0.1",
15+
"shelljs": "~0.3.0",
16+
"inquirer": "~0.7.1",
17+
"connect": "~3.1.1",
18+
"request": "~2.42.0",
1919
"browser-sync": "^1.3.6"
2020
},
2121
"repository": {

test/test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,10 @@ var server = http.createServer(app).listen(port, function() {
2424
assert.fail('"ok" not found in response.');
2525
}
2626

27-
if (!/<\s*script\s*>/i.test(body)) {
27+
if (!/<\s*script/i.test(body)) {
2828
assert.fail('<script> tag not found in response.');
2929
}
30-
30+
3131
process.exit();
3232
});
3333
});

0 commit comments

Comments
 (0)