node package manager
Easy collaboration. Discover, share, and reuse code in your team. Create a free org »


documentify stability

npm version build status downloads js-standard-style

Modular HTML bundler.


  $ documentify [entry-file] [options]
    -h, --help        print usage
    -v, --version     print version
    Start bundling HTML
    $ documentify .
    Bundle HTML from a stream
    $ cat index.html | documentify
  Running into trouble? Feel free to file an issue:
  Do you enjoy using this software? Become a backer:

Configuring transforms

Command Line

$ documentify ./index.html -t my-transform -t another-transform


  "name": "my-app",
  "version": "1.0.0",
  "private": true,
  "documentify": {
    "transform": [

Writing transforms

A transform is a regular function that returns a through stream. The through stream can modify the HTML stream, which in turn passes data to the next stream. Together the streams form a pipeline.

var through = require('through2')
module.exports = transform
function transform (opts) {
  return through()


document = documentify(entry, [html], [opts])

Create a new documentify instance. If entry is a .html file, it'll be used as the source. If entry is falsy and html is a string or readable stream, that will be used as the input instead. Otherwise if entry is falsy and html is omitted, an empty HTML file with just a body and head will be used as the source.

document.transform(fn, [opts])

Pass a transform to the document instance

readableStream = document.bundle()

Create a new readable stream, and start flowing the html through the transforms.

See Also