Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including mustache-express with all npm packages installed. Try it out:

var mustacheExpress = require("mustache-express")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

mustache-express v1.2.5

Use mustache, including partials, in Express 3

The Mustache Express

Build Status

Mustache Express lets you use Mustache and Express (at least version 3) together, including auto-loading partials.

Usage

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');

Parameters

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.

Properties

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.

Metadata

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free