$ gnpm install script-injector
#script-injector
trumpet
to parse your html.npm install script-injector
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.
Copyright 2013 - present © cnpmjs.org | Home |