
Security News
libxml2 Maintainer Ends Embargoed Vulnerability Reports, Citing Unsustainable Burden
Libxml2’s solo maintainer drops embargoed security fixes, highlighting the burden on unpaid volunteers who keep critical open source software secure.
inject-lr-script
Advanced tools
Inject the LiveReload script snippet into a HTML response.
This detects .htm
and .html
and ensures they have text/html
accept headers, if not yet set.
Example:
var liveReload = require('inject-lr-script')
var stacked = require('stacked')
var http = require('http')
var serveStatic = require('serve-static')
var app = stacked()
app.use(liveReload())
app.use(serveStatic('app/'))
var server = http.createServer(app)
Note: This expects a <body>
tag to be present in the HTML.
middleware = liveReload([opt])
Returns a function middleware(req, res, next)
which injects a LiveReload <script>
tag into the body of an HTML script.
Options:
port
the live reload server port, default 35729host
the host, default localhost
path
the script path, default '/livereload.js?snipver=1'
local
if true, the script will ignore the port
and host
and assumes its hosted locally on the same domain, default falsetype
the script type, default "text/javascript"
, could also be "module"
for ES modulesdefer
a boolean whether to add this attribute to the script tag, default true
async
a boolean whether to add this attribute to the script tag, default true
You can also change the options at runtime:
var liveReload = require('inject-lr-script')
var liveInjector = liveReload()
handler.use(function (req, res, next) {
if (liveReload) {
liveInjector.host = myHost
liveInjector.port = myPort
liveInjector(req, res, next)
} else {
next()
}
})
MIT, see LICENSE.md for details.
FAQs
inject live reload into HTML content
We found that inject-lr-script demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Libxml2’s solo maintainer drops embargoed security fixes, highlighting the burden on unpaid volunteers who keep critical open source software secure.
Research
Security News
Socket researchers uncover how browser extensions in trusted stores are used to hijack sessions, redirect traffic, and manipulate user behavior.
Research
Security News
An in-depth analysis of credential stealers, crypto drainers, cryptojackers, and clipboard hijackers abusing open source package registries to compromise Web3 development environments.