An open API service indexing awesome lists of open source software.

https://github.com/75lb/stream-handlebars

Extends handlebars with a streaming interface for .compile().
https://github.com/75lb/stream-handlebars

Last synced: 10 months ago
JSON representation

Extends handlebars with a streaming interface for .compile().

Awesome Lists containing this project

README

          

[![view on npm](http://img.shields.io/npm/v/stream-handlebars.svg)](https://www.npmjs.org/package/stream-handlebars)
[![npm module downloads per month](http://img.shields.io/npm/dm/stream-handlebars.svg)](https://www.npmjs.org/package/stream-handlebars)
[![Build Status](https://travis-ci.org/75lb/stream-handlebars.svg?branch=master)](https://travis-ci.org/75lb/stream-handlebars)
[![Dependency Status](https://david-dm.org/75lb/stream-handlebars.svg)](https://david-dm.org/75lb/stream-handlebars)
[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)](https://github.com/feross/standard)

## stream-handlebars
Extends handlebars with a streaming interface for .compile().

**Example**
```js
var handlebars = require('stream-handlebars')
var fs = require('fs')

var template = '

\{{paragraph}}

'

// 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)
```

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

### handlebars : object
The regular [handlebars](http://handlebarsjs.com) module.

**Kind**: Exported namespace
**Extends:** [handlebars](http://handlebarsjs.com)

#### handlebars.createCompileStream(template, [options]) ⇒ [Transform](https://nodejs.org/api/stream.html#stream_class_stream_transform)
a stream wrapper for the [handlebars.compile](http://handlebarsjs.com/reference.html) function

**Kind**: static method of [handlebars](#exp_module_stream-handlebars--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](https://github.com/75lb/jsdoc-to-markdown).