A Connect/Express middleware for injecting arbitrary script tags or content into HTML responses by intercepting res.write and res.end. v0.4.0 is the latest stable release; package appears unmaintained since 2015 (no recent commits, no changelog). Forked from connect-livereload, it adds support for multiple injection rules and array snippets. Unlike alternatives (e.g., inject-lr-script), it does not require a live-reload server and allows full snippet customization. Works with any Connect-compatible framework (Connect, Express, Grunt connect). Only notable differentiator is the `runAll` option for applying multiple injection rules sequentially.
npm install connect-injectVerified import paths — ran on the pinned version, not inferred.
Demonstrates basic use of connect-inject middleware with Express, injecting two script tags into HTML responses.
Migrate to actively maintained alternatives like connect-livereload (original) or inject-lr-script.
Always call the function: app.use(require('connect-inject')({...})).Override the ignore option: ignore: [] to disable filtering.
Avoid using for non-HTML endpoints or provide a custom html option that checks Content-Type header.
Ensure rule matches are independent or order them appropriately (e.g., head before body).
Add parentheses: require('connect-inject')()Pass an options object with a snippet property: require('connect-inject')({ snippet: '...' })Override ignore option: ignore: [] or remove unneeded entries.
No dependency data recorded yet.