Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

html-assets-inject

fengzilong8MIT0.0.2

My transcendent module

readme

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