Stand with Ukraine 🇺🇦
Eleventy
The possum is Eleventy’s mascot

Eleventy Documentation

WARNING:
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 Jump to heading

Contents

Add an .eleventyignore file to your input directory or project root directory 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 Jump to heading

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

Configuration API Added in v1.0.0 Jump to heading

You can programmatically add and delete ignores in your configuration file. eleventyConfig.ignores is a JavaScript Set.

The ignores Set starts with a default **/node_modules/** entry in Eleventy v2.0 (it was node_modules/** in v1.0).

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

Added in v2.0.0These were decoupled from the ignores used for the file watcher.

Defaults Jump to heading

.gitignore entries Jump to heading

Paths listed in your project’s .gitignore file are automatically ignored. You can opt-out of this behavior.

node_modules Added in v1.0.0 Jump to heading

node_modules folders are always ignored by Eleventy. This makes new Eleventy projects easier and helps developers new to Eleventy get ramped up easier too.

INFO:
The node_modules behavior in Eleventy 1.0 only ignores the project root node_modules/**. Eleventy 2.0.0-canary.15 and newer ignores all node_modules folders using **/node_modules/**.

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) {
// in Eleventy 2.0
eleventyConfig.ignores.delete("**/node_modules/**");

// in Eleventy 1.0
eleventyConfig.ignores.delete("node_modules/**");
};
INFO:
The node_modules behavior changed in Eleventy 1.0. If you’re still using Eleventy 0.x, read the 0.x documentation.

Ignore File Locations Jump to heading

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

INFO:
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 Jump to heading

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: