Black Lives Matter
Eleventy
The possum is Eleventy’s mascot

Eleventy Documentation

This is an older version of Eleventy. Go to the newest Eleventy docs (current path: /docs/ignores/) or the full release history.
Menu

Ignore Template Files #

Add an .eleventyignore file to your input directory or project root directory (New in v0.7.0) for a new line-separated list of files (or globs) that will not be processed by Eleventy. Note that any paths listed in your project’s .gitignore file are automatically ignored—you don’t need to duplicate them to your .eleventyignore file. Layouts, include files, extends, partials, macros, and other lower level template features aren’t relevant to this feature.

Sample .eleventyignore #

Filename .eleventyignore
README.md
_drafts/
secretNunjucksTemplates/anotherFolder/**/*.njk

Configuration API New in v1.0.0 #

You can programmatically add and delete ignores in your configuration file. eleventyConfig.ignores is a JavaScript Set. It starts with a default node_modules/** entry.

module.exports = function(eleventyConfig) {
eleventyConfig.ignores.add("README.md");
eleventyConfig.ignores.delete("README.md");
};

Defaults #

.gitignore entries #

Paths listed in your project’s .gitignore file are automatically ignored.

node_modules New in v1.0.0 #

The node_modules behavior changed in Eleventy 1.0. If you’re still using Eleventy 0.x, read the 0.x documentation.

The project root node_modules folder is always ignored by Eleventy. This makes new Eleventy projects easier and helps developers new to Eleventy get ramped up easier too.

If you want to opt-out and search for templates inside of your node_modules folder, delete the entry using the Configuration API:

Filename .eleventy.js
module.exports = function(eleventyConfig) {
eleventyConfig.ignores.delete("node_modules/**");
};

File Locations #

We look for ignores in these files. Entries are relative to the ignore file’s location.

Starting in Eleventy 1.0 support for a .gitignore file in a separate input directory was removed. Read more at Issue #364.

Opt-out of using .gitignore New in v0.3.5 #

You can disable automatic use of your .gitignore file by using the Configuration API method: eleventyConfig.setUseGitIgnore(false);.

Filename .eleventy.js
module.exports = function(eleventyConfig) {
eleventyConfig.setUseGitIgnore(false);
};

When using .gitignore is disabled, .eleventyignore will be the single source of truth for ignored files. This also means that your node_modules directory will be processed unless otherwise specified in your .eleventyignore file.


Other pages in Configuration: