0.5.0 • Published 7 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-html
yarn add pull-bundle-html
Usage
html(path?, settings)
Takes JS and CSS files out of the stream, and bundles them into boilerplate HTML with your settings
pass
to let non-JS/CSS files pass through. Defaults totrue
lang
sets the<html lang=...>
attribute. Defaults toen-US
title
sets the<title>...</title>
elementbody
is a string of HTML to put before where the JS is injected. e.g. a mount element for vdomcharset
sets the<meta charset=...>
element. Defaults toutf-8
description
sets the<meta name='description'>
elementkeywords
sets the<meta name='keywords'>
elementbase
sets thefile.base
on the output HTML filescriptAsync
lets the JS files load async by setting<script async="true">
in the<head>
Also see
pull-files
for reading and writing filespull-bundle-js
for bundling JS with Browserify
Maintained by Jamen Marz (See on Twitter and GitHub for questions & updates)