Skip to navigation Skip to main content
Back the Build Awesome Kickstarter!

Mustache

On this page
Eleventy Short Name File Extension npm Package
mustache .mustache mustache
Eleventy or Plugin version mustache version
@11ty/eleventy@0.x mustache@2.x
@11ty/eleventy@1.x mustache@4.x
@11ty/eleventy@2.x mustache@4.x
@11ty/eleventy@3.x and newer N/A
@11ty/eleventy-plugin-mustache@1.x mustache@4.x

You can override a .mustache file’s template engine. Read more at Changing a Template’s Rendering Engine.

Installation

The .mustache templating language was moved out of Eleventy core in v3 and now requires a plugin installation.

npm install @11ty/eleventy-plugin-mustache

Add to your configuration file:

eleventy.config.js
import mustachePlugin from "@11ty/eleventy-plugin-mustache";

export default function (eleventyConfig) {
	eleventyConfig.addPlugin(mustachePlugin);
}
const mustachePlugin = require("@11ty/eleventy-plugin-mustache");

module.exports = function (eleventyConfig) {
	eleventyConfig.addPlugin(mustachePlugin);
}

Use more options:

eleventy.config.js
import mustache from "mustache";
import mustachePlugin from "@11ty/eleventy-plugin-mustache";

export default function (eleventyConfig) {
	eleventyConfig.addPlugin(mustachePlugin, {
		// Override the `mustache` library instance
		eleventyLibraryOverride: mustache,
	});
}
const mustache = require("mustache");
const mustachePlugin = require("@11ty/eleventy-plugin-mustache");

module.exports = function (eleventyConfig) {
	eleventyConfig.addPlugin(mustachePlugin, {
		// Override the `mustache` library instance
		eleventyLibraryOverride: mustache,
	});
}

Supported Features

Feature Syntax
✅ Partials {{> user}} looks for _includes/user.mustache. Does not process front matter in the include file.
🚫 Partials (Relative Path) Not yet supported: {{> ./user}} looks for user.mustache in the template’s current directory.