felid-handlebars
A Felid plugin for rendering Handlebars templates.
Install
npm install felid-handlebars
or
yarn add felid-handlebars
Usage
const Felid = const handlebars = const app = app app
Options
- root: String: The directory where your template files locates. Default to the directory where node runs.
- charset: String: The charset your templates use. Default is:
utf-8
. - production: Boolean: If
true
, an LRU cache will be used to caching templates. Default is depend on the value ofprocess.env.NODE_ENV
. - initCache: Boolean: Whether to initialize the template caches when the plugin is being loaded. Default is:
false
. - cacheOptions: Object: The options passed to
lru-cache
. Wheremax
has a default value of100
. - decorator Object: Customize the decorator names. Default is:
render: 'render'
- onInit Function(engine HandlebarsInstance): If you need to customize the environment of Handlebars, just do it here! Read more about what you can do with Handlebars.
app
- onProcess Function(html String) => String: A function used to process the HTML string before it is sent to the client.
app
- onError Function(error: Error, response: FelidResponse): A function invoked when an error occured in
res.render()
.
API
- response.render(template: String, context?: Object): Render the template using the context.