0.0.2 • Published 9 years ago
html-assets-inject v0.0.2
html-assets-inject
Install
$ npm install --save html-assets-inject
Usage
var htmlAssetsInject = require('html-assets-inject');
htmlAssetsInject('<html><head><title>inject</title></head><body>some text...</body></html>', {
assets: [
{
type: 'css',
url: 'http://foo.com/bar.css',
inject: 'head'
},
{
type: 'js',
url: 'http://foo.com/bar.js',
inject: 'body'
}
]
});
//=> '<html><head><title>inject</title><link rel="stylesheet" href="http://foo.com/bar.css" type="text/css" /></head><body>some text...<script type="text/javascript" src="http://foo.com/bar.js"></script></body></html>'
API
htmlAssetsInject(htmlContent, options)
htmlContent
Type: string
options
Type: object
License
MIT © hzfengzilong