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().
- Host: GitHub
- URL: https://github.com/75lb/stream-handlebars
- Owner: 75lb
- License: mit
- Archived: true
- Created: 2015-03-14T21:10:37.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2016-07-27T20:56:17.000Z (almost 10 years ago)
- Last Synced: 2024-04-24T13:11:00.024Z (over 2 years ago)
- Language: JavaScript
- Size: 22.5 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://www.npmjs.org/package/stream-handlebars)
[](https://www.npmjs.org/package/stream-handlebars)
[](https://travis-ci.org/75lb/stream-handlebars)
[](https://david-dm.org/75lb/stream-handlebars)
[](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).