0.5.0 • Published 8 years ago
pull-bundle-html v0.5.0
pull-bundle-html
Bundle JS and CSS into boilerplate HTML
const pull = require('pull-stream')
const { read, write } = require('pull-files')
const bundle = require('pull-bundle-js')
const html = require('pull-bundle-html')
pull(
read([ 'index.js', 'index.css' ]),
bundle([ 'esfp' ]),
html('app.html', { ...options }),
write('out', err => {
// done
})
)Also look at pull-bundle-js to Browserify the JavaScript.
Install
npm install --save pull-bundle-htmlyarn add pull-bundle-htmlUsage
html(path?, settings)
Takes JS and CSS files out of the stream, and bundles them into boilerplate HTML with your settings
passto let non-JS/CSS files pass through. Defaults totruelangsets the<html lang=...>attribute. Defaults toen-UStitlesets the<title>...</title>elementbodyis a string of HTML to put before where the JS is injected. e.g. a mount element for vdomcharsetsets the<meta charset=...>element. Defaults toutf-8descriptionsets the<meta name='description'>elementkeywordssets the<meta name='keywords'>elementbasesets thefile.baseon the output HTML filescriptAsynclets the JS files load async by setting<script async="true">in the<head>
Also see
pull-filesfor reading and writing filespull-bundle-jsfor bundling JS with Browserify
Maintained by Jamen Marz (See on Twitter and GitHub for questions & updates)