Fork of hogan.js that falls back to file system for partials.
fs-hogan is a fork of Hogan.js, a fast mustache-compatible templating engine that supports template inheritance (supers), a feature that may make it into the official spec for mustache v2.0.0. The goal of fs-hogan is to take advantage of Hogan.js while also making rendering templates from the file system a breeze.
$ npm install fs-hogan
var hogan = require'fs-hogan';
- cache: if
true, fs-hogan will cache file templates after they are read from disk. [default:
- templates: the path fs-hogan will look for templates in. [default:
- extension: the file extension used for templates. [default:
In addition to these options, fs-hogan also supports the compilation options of Hogan.js.
value. To set multiple options at once, you can pass in an object that maps keys to options. Returns
hogan so you can configure fs-hogan while requiring it.
Asynchronously renders the template that exists at
path with the context provided by
context and then calls
callback with 2 arguments:
path is a relative path,
templates will be used as the base path.
A working example of fs-hogan exists in the /examples directory.
fs-hogan works great with Express.
var express = require'express';var hogan = require'fs-hogan';var app = express;appconfigureappset'views' __dirname + '/views';appset'view engine' 'hjs';hoganset templates: appget'views' extension: appget'view engine' ;appengine'hjs' hoganrenderFile;;
Found a bug? Create an issue on GitHub.
For transparency and insight into the release cycle, releases will be numbered with the follow format:
And constructed with the following guidelines:
- Breaking backwards compatibility bumps the major
- New additions without breaking backwards compatibility bumps the minor
- Bug fixes and misc changes bump the patch
For more information on semantic versioning, please visit http://semver.org/.
Copyright (c) 2012 Jake Harding
Licensed under the MIT License.