script-injector
Inject inline javascript into an HTML stream.
Last updated 10 years ago by dlmanning .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ gnpm install script-injector 
SYNC missed versions from official npm registry.

#script-injector

  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

Installation

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

fs.createReadStream('anHTMLFile')
  .pipe(scriptInjector(aFunction))
  .pipe(someOtherPlace);

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

Current Tags

  • 1.0.0                                ...           latest (10 years ago)

10 Versions

  • 1.0.0                                ...           10 years ago
  • 0.1.7                                ...           11 years ago
  • 0.1.6                                ...           11 years ago
  • 0.1.5                                ...           11 years ago
  • 0.1.4                                ...           11 years ago
  • 0.1.3                                ...           11 years ago
  • 0.1.2                                ...           11 years ago
  • 0.1.1                                ...           11 years ago
  • 0.1.0                                ...           11 years ago
  • 0.0.1                                ...           12 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (3)
Dev Dependencies (2)
Dependents (1)

Copyright 2013 - present © cnpmjs.org | Home |