stream-handlebars

Extends handlebars with a streaming interface for .compile()

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
stream-handlebars
0.2.08 years ago9 years agoMinified + gzip package size for stream-handlebars in KB

Readme

view on npm npm module downloads per month Build Status Dependency Status js-standard-style

stream-handlebars

Extends handlebars with a streaming interface for .compile().
Example
var handlebars = require('stream-handlebars')
var fs = require('fs')

var template = '<p>\{{paragraph}}</p>'

// it's just regular handlebars..
handlebars.registerPartial('whatever', 'the partial content')

// ..with the addition of a streaming interface for .compile()
var compileStream = handlebars.createCompileStream(template)

// the template is compiled using the piped-in JSON as context
fs.createReadStream('./template-data.json', 'utf8')
    .pipe(compileStream)
    .pipe(process.stdout)

* [handlebars](#exp_module_stream-handlebars--handlebars) : <code>object</code> ⏏
    * [.createCompileStream(template, [options])](#module_stream-handlebars--handlebars.createCompileStream) ⇒ <code>[Transform](https://nodejs.org/api/stream.html#stream_class_stream_transform)</code>

handlebars : object

The regular handlebars module.
Kind: Exported namespace
Extends: handlebars

handlebars.createCompileStream(template, options) ⇒ Transform

a stream wrapper for the handlebars.compile function
Kind: static method of handlebars
| Param | Type | Description | | --- | --- | --- | | template | string | required template | | options | object | options passed to both Transform() and .compile() | | options.objectMode | object | set to true if you wish you pass in the data as an object | | options.data | object | default data object |
© 2015-16 Lloyd Brookes \<75pound@gmail.com\>. Documented by jsdoc-to-markdown.