0.5.0 • Published 7 years ago

pull-bundle-html v0.5.0

Weekly downloads
23
License
-
Repository
github
Last release
7 years ago

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 to true
  • lang sets the <html lang=...> attribute. Defaults to en-US
  • title sets the <title>...</title> element
  • body is a string of HTML to put before where the JS is injected. e.g. a mount element for vdom
  • charset sets the <meta charset=...> element. Defaults to utf-8
  • description sets the <meta name='description'> element
  • keywords sets the <meta name='keywords'> element
  • base sets the file.base on the output HTML file
  • scriptAsync lets the JS files load async by setting <script async="true"> in the <head>

Also see


Maintained by Jamen Marz (See on Twitter and GitHub for questions & updates)