Use mustache, including partials, in Express 3
Want to see pretty graphs? Log in now!
npm install mustache-express
|49||downloads in the last week|
|165||downloads in the last month|
|Last Published By|
|Version||1.0.1 last updated 2 months ago|
|Dependencies||async, lru-cache, mustache|
The Mustache Express
Mustache Express lets you use Mustache and Express 3 together, including auto-loading partials.
var mustacheExpress = require('mustache-express'); // Register '.mustache' extension with The Mustache Express app.engine('mustache', mustacheExpress()); app.set('view engine', 'mustache'); app.set('views', __dirname + '/views');
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.
The return function has a
cache parameter that is an LRU Cache.
var engine = mustacheExpress(); var cache = engine.cache; // Caches the full file name with some internal data.