1 | # The Mustache Express
|
2 |
|
3 | [![Build Status](https://travis-ci.org/bryanburgers/node-mustache-express.png)](https://travis-ci.org/bryanburgers/node-mustache-express)
|
4 |
|
5 | Mustache Express lets you use Mustache and Express (at least version 3) together, including auto-loading partials.
|
6 |
|
7 | ## Usage
|
8 |
|
9 | var mustacheExpress = require('mustache-express');
|
10 |
|
11 | // Register '.mustache' extension with The Mustache Express
|
12 | app.engine('mustache', mustacheExpress());
|
13 |
|
14 | app.set('view engine', 'mustache');
|
15 | app.set('views', __dirname + '/views');
|
16 |
|
17 | ## Parameters
|
18 |
|
19 | The mustacheExpress method can take two parameters: the directory of the partials and the extension of the partials. When a partial is requested by a template, the file will be loaded from `path.resolve(directory, partialName + extension)`. By default, these values are determined by Express.
|
20 |
|
21 | ## Properties
|
22 |
|
23 | The return function has a `cache` parameter that is an [LRU Cache](https://github.com/isaacs/node-lru-cache).
|
24 |
|
25 | var engine = mustacheExpress();
|
26 | var cache = engine.cache; // Caches the full file name with some internal data.
|