diff --git a/README.md b/README.md index d3a3ba0..9af3898 100644 --- a/README.md +++ b/README.md @@ -185,6 +185,14 @@ Create isolated engine instances with their own cache system and handlebars engi var instance1 = hbs.create(); var instance2 = hbs.create(); +## Template options + +The main use case for template options is setting the handlebars "data" object - this creates global template variables accessible with an `@` prefix. + +Template options can be set in 3 ways. When setting global template options they can be [passed as config on creation of an instance](https://github.com/barc/express-hbs#usage), and they can also be updated used the `updateTemplateOptions(templateOptions)` method of an instance. To set template options for an individual request they can be set on `res.locals` using the helper method `updateLocalTemplateOptions(locals, templateOptions)`. + +Both of these methods have a companion method `getTemplateOptions()` and `getLocalTemplateOptions(locals)`, which should be used when extending or merging the current options. + ## Example in File `app.js`