Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/joeybaker/handlebars-precompile-directory
Precompile a directory of handlebars templates
https://github.com/joeybaker/handlebars-precompile-directory
Last synced: 6 days ago
JSON representation
Precompile a directory of handlebars templates
- Host: GitHub
- URL: https://github.com/joeybaker/handlebars-precompile-directory
- Owner: joeybaker
- License: mit
- Created: 2014-02-17T20:04:17.000Z (almost 11 years ago)
- Default Branch: master
- Last Pushed: 2014-04-30T18:08:47.000Z (over 10 years ago)
- Last Synced: 2024-11-26T14:42:29.472Z (about 2 months ago)
- Language: JavaScript
- Size: 153 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
handlebars-precompile-directory
===============================[![NPM](https://nodei.co/npm/handlebars-precompile-directory.png)](https://nodei.co/npm/handlebars-precompile-directory/)
Precompile a directory of handlebars templates.
## Usage
```js
var getTemplates = require('handlebars-precompile-directory')
, path = require('path')getTemplates({
templates: path.resolve('./templates')
, ext: 'hbs'
}, function getTemplateCallback(templates){
// templates.template1({value: 'hi'})
// templates['directory/has/nested/templates/template2']({value: 'hello'})
})
```## Options
### Options object
#### `templates`
The full path to the template directory.**NOTE**: file names that begin with a `_` will be treated as partials.
#### `ext`
The extension to look for. Defaults to `hbs`.### callback `function(templates)`
The only argument is a templates object that contains all the pre-compiled templates.## Test
Tests are all mocha, and can be run without installing mocha globally with `npm test`.## Changelog
0.1.0 Init