Inject inline javascript into an HTML stream.

npm install script-injector
89 downloads in the last day
284 downloads in the last week
1 203 downloads in the last month


  1. provides a through stream that allows you to inject inline javascript into an html text stream.
  2. Uses trumpet to parse your html.
  3. Should only be used for good, never for evil


npm install script-injector

How to use

Just pipe a stream of html through script-injector. You can pass in either some stringified code or a function object. What could be easier?

scriptInjector = require('script-injector');

// Then do something like this somewhere else


script-injector will insert the provided code before your first script tags, or just before </body> if you don't have any other scripts.

npm loves you