Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
zachleat committed Nov 18, 2022
1 parent 243c413 commit 821d157
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 3 deletions.
8 changes: 6 additions & 2 deletions src/docs/ignores.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ secretNunjucksTemplates/anotherFolder/**/*.njk

## Configuration API {% addedin "1.0.0" %}

You can programmatically add and delete ignores in your configuration file. `eleventyConfig.ignores` is a JavaScript [`Set`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set#instance_methods). It starts with a default `node_modules/**` entry.
You can programmatically add and delete ignores in your configuration file. `eleventyConfig.ignores` is a JavaScript [`Set`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set#instance_methods).

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

```js
module.exports = function(eleventyConfig) {
Expand All @@ -29,11 +31,13 @@ module.exports = function(eleventyConfig) {
};
```

{% addedin "v2.0.0-canary.18" %}These were decoupled from the [ignores used for the file watcher](/docs/watch-serve/#ignore-watching-files).

## Defaults

### `.gitignore` entries

Paths listed in your project’s `.gitignore` file are automatically ignored.
Paths listed in your project’s `.gitignore` file are automatically ignored. You can [opt-out of this behavior](#opt-out-of-using-.gitignore).

### `node_modules` {% addedin "1.0.0" %}

Expand Down
26 changes: 25 additions & 1 deletion src/docs/watch-serve.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,31 @@ module.exports = function(eleventyConfig) {
};
```

Eleventy will not add a watch for files or folders that are in `.gitignore`, unless `setUseGitIgnore` is turned off. See the chapter on [ignore files](/docs/ignores/#opt-out-of-using-.gitignore).
## Ignore Watching Files

### `.gitignore`

Eleventy will ignore files or folders listed in your `.gitignore` file by default, [unless `setUseGitIgnore` is turned off](/docs/ignores/#opt-out-of-using-.gitignore).

### Configuration API

{% addedin "v2.0.0-canary.18" %}

Previously, [the configuration API ignores for template processing](/docs/ignores/#configuration-api) were also used as ignores for watching (e.g. `eleventyConfig.ignores.add("README.md")`).

New in v2.0.0-canary.18, watch target ignores now have their own dedicated API:

```js
module.exports = function(eleventyConfig) {
// Do not rebuild when README.md changes (You can use a glob here too)
eleventyConfig.watchIgnores.add("README.md");

// Or delete entries too
eleventyConfig.watchIgnores.delete("README.md");
};
```

The `watchIgnores` Set starts with a default `**/node_modules/**` entry.

## Add delay before re-running {% addedin "0.11.0" %}

Expand Down

0 comments on commit 821d157

Please sign in to comment.