Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »

inline-htmlify

2.0.1 • Public • Published

inline-htmlify Build Status

Stream JS code in and get an HTML document out

Install

$ npm install --save inline-htmlify

Usage

var htmlify = require('inline-htmlify')
 
browserify('app.js')
  .pipe(htmlify())
  .pipe(fs.createWriteStream('index.html'))
browserify app.js | htmlify > index.html

Or using a custom document (doc.html):

browserify('app.js')
  .pipe(htmlify(fs.createReadStream('doc.html')))
  .pipe(fs.createWriteStream('index.html'))
cat script.js | htmlify doc.html > index.html

The html file doc.html should have a <script> tag with the attribute inline-htmlify:

<script inline-htmlify></script>

API

htmlify(document) -> stream

Returns a stream that takes in JavaScript and wraps it in an HTML document.

document

A streaming HTML document. The script will be inserted inside a <script inline-htmlify></script> tag. The attribute is used to locate the insertion point and is removed from the final output.

Type: stream
Default: stream of document.html

License

MIT © Ben Drucker

install

npm i inline-htmlify

Downloadsweekly downloads

11

version

2.0.1

license

MIT

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar