Pug
Template Languages:
Eleventy Short Name | File Extension | NPM Package |
---|---|---|
pug | .pug | pug |
Pug templates used to be called Jade templates and the project was renamed.
You can override a .pug
file’s template engine. Read more at Changing a Template’s Rendering Engine.
Pug Options #
Optional: Compile/Render Options New in v0.2.15 #
Set compile/render options using the Configuration API. See all Pug options.
module.exports = function(eleventyConfig) {
eleventyConfig.setPugOptions({ debug: true });
};
Optional: Set your own Library instance New in v0.3.0 #
As an escape mechanism for advanced usage, pass in your own instance of the Pug library using the Configuration API.
module.exports = function(eleventyConfig) {
let pug = require("pug");
eleventyConfig.setLibrary("pug", pug);
};
Supported Features #
Feature | Syntax |
---|---|
✅ Includes (Absolute) | include /includedvar.pug looks in _includes/includedvar.pug (does not process front matter) |
✅ Includes (Relative) (New in Eleventy v0.2.15 ) | include includedvar.pug looks in _includes/includedvar.pug (does not process front matter) |
✅ Extends (Absolute) | extends /layout.pug looks in _includes/layout.pug (does not process front matter) |
✅ Extends (Relative) (New in Eleventy v0.2.15 ) | extends layout.pug looks in _includes/layout.pug (does not process front matter) |