.gitignore is assumed to live at the root of the input directory—maybe it shouldn’t? Might make sense to check to see if that lives in the command root instead (more likely to match the repo root)
Relevant docs: https://www.11ty.io/docs/ignores/
Surfaced in #228
.gitignorealso lives in the root of the input directory—maybe it shouldn’t?
Let’s first clarify terminology. What is the command root and what is the input root?
Assuming I cloned the repository for my site to ~/kleinfreund.de, I have a ~/kleinfreund.de/.gitignore, a ~/kleinfreund.de/.eleventy.js and would also expect ~/kleinfreund.de/.eleventyignore to be located there. I call ~/kleinfreund.de the project root and it sounds like you call it command root (i.e. the place from where you run the eleventy command).
Also, the concept of having a dedicated include directory turned out to have more downsides than benefits for me (e.g includes being input-directory-relative which they shouldn’t). This is why I have set the include directory to "" which results in the include directory being the same as the project directory if the default for the input directory is not changed.
TL;DR: In my opinion, all configuration-type files that are global should reside in the project root directory, not in any subdirectory.
I presume this is talking about .eleventyignore rather than .gitignore?
I strongly agree with @kleinfreund. Project root matches the common use case of .gitignore and my impression of where other projects tend to store config type files.
Possibly you could consider a .eleventy.js config override to let users specify another location, but this might be too complex.
I agree—the current behavior is wrong.
~/kleinfreund.de would be the command/project root (where I’d run eleventy from)--input=src then ~/kleinfreund.de/src/ would be my input root (where eleventy would search for templates)The good news is that it’d be somewhat cheap to look in multiple locations for these two files.
In 0.7.0 eleventy will now search for:
.gitignore in the:
input directory (for backwards compatibility, although I’d argue this doesn’t make sense to do any more 🤡).eleventyignore in the:
input directoryIgnore entries found in these files will be normalized using the directory they reside in.
For example, npx eleventy --input=src with an src/.eleventyignore file with the following content…
mytemplate1.md
mytemplate2.md
…will normalize entries starting with src a la !./src/mytemplate1.md or !./src/mytemplate2.md and a root directory ./.eleventyignore will normalize to !./mytemplate1.md and !./mytemplate2.md
for backwards compatibility, although I’d argue this doesn’t make sense to do any more clown_face
@zachleat Maybe drop this backwards-compatibility feature in the next major version?