Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding option for inject-in-head for inject-lr-script #232

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ node_modules
bundle.js
bundle-expected.js
.tmp
build
build
.vscode
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ Options:
--no-error-handler disable default DOM error handling
--watch-glob, --wg glob(s) to watch for reloads, default '**/*.{html,css}'
--static-options subarg options to pass to serve-static module
--inject-in-head forces live-reload script to be injected in the head tag
```

By default, messages will be printed to `process.stdout`, and `--debug` will be sent to browserify (for source maps). You can turn these off with `--no-stream` and `--no-debug`, respectively.
Expand Down
6 changes: 3 additions & 3 deletions lib/middleware.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,9 @@ function budoMiddleware (entryMiddleware, opts) {
}

// Inject liveReload snippet on response
var liveInjector = liveReload({
local: true
})
var liveReloadOpts = opts.injectInHead ? { local: true, injectInHead: true } : { local: true }
var liveInjector = liveReload(liveReloadOpts)

// this is lazily set and cannot be changed dynamically
var liveScriptUrl
// By default, attempt to optimize the response
Expand Down
6 changes: 4 additions & 2 deletions lib/parse-args.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ function parseArgs (args, opt) {
'ndjson',
'verbose',
'cors',
'ssl'
'ssl',
'injectInHead'
],
string: [
'host',
Expand Down Expand Up @@ -51,7 +52,8 @@ function parseArgs (args, opt) {
watchGlob: [ 'wg', 'watch-glob' ],
errorHandler: 'error-handler',
forceDefaultIndex: 'force-default-index',
pushstate: 'P'
pushstate: 'P',
injectInHead: 'inject-in-head'
},
'--': true
})
Expand Down