Skip to content

Commit 3f67a2f

Browse files
Mike-Daxpieh
authored andcommitted
feat(gatsby-source-filesystem): Added an 'ignore' property to the options to ignore more files. (#8016)
* feat(gatsby-source-filesystem): Added an 'ignore' property to the options to ignore more files. * docs(gatsby-source-filesystem): Added an options section to the README and fixed an error in the example. * update default list
1 parent 29ce50e commit 3f67a2f

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

packages/gatsby-source-filesystem/README.md

+18
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,30 @@ module.exports = {
3535
options: {
3636
name: `data`,
3737
path: `${__dirname}/src/data/`,
38+
ignore: [`**/\.*`], // ignore files starting with a dot
3839
},
3940
},
4041
],
4142
}
4243
```
4344

45+
## Options
46+
47+
In addition to the name and path parameters you may pass an optional `ignore` array of file globs to ignore.
48+
49+
They will be added to the following default list:
50+
51+
```
52+
**/*.un~
53+
**/.DS_Store
54+
**/.gitignore
55+
**/.npmignore
56+
**/.babelrc
57+
**/yarn.lock
58+
**/node_modules
59+
../**/dist/**
60+
```
61+
4462
## How to query
4563

4664
You can query file nodes like the following:

packages/gatsby-source-filesystem/src/gatsby-node.js

+1
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,7 @@ See docs here - https://www.gatsbyjs.org/packages/gatsby-source-filesystem/
136136
`**/yarn.lock`,
137137
`**/node_modules`,
138138
`../**/dist/**`,
139+
...(pluginOptions.ignore || []),
139140
],
140141
})
141142

0 commit comments

Comments
 (0)