Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Default location of .gitignore and .eleventyignore files #229

Closed
zachleat opened this issue Sep 16, 2018 · 5 comments
Closed

Default location of .gitignore and .eleventyignore files #229

zachleat opened this issue Sep 16, 2018 · 5 comments
Assignees
Milestone

Comments

@zachleat
Copy link
Member

.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

@zachleat zachleat added the needs-discussion Please leave your opinion! This request is open for feedback from devs. label Sep 16, 2018
@kleinfreund
Copy link
Contributor

kleinfreund commented Sep 16, 2018

.gitignore also 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.

@edwardhorsford
Copy link
Contributor

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.

@zachleat zachleat changed the title Default location of .gitignore check Default location of .gitignore and .eleventyignore files Sep 16, 2018
@zachleat
Copy link
Member Author

I agree—the current behavior is wrong.

  • ~/kleinfreund.de would be the command/project root (where I’d run eleventy from)
  • If I used --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.

@zachleat zachleat added high-priority bug and removed needs-discussion Please leave your opinion! This request is open for feedback from devs. labels Jan 7, 2019
@zachleat zachleat added this to the 0.7.0 milestone Jan 8, 2019
@zachleat
Copy link
Member Author

zachleat commented Jan 8, 2019

In 0.7.0 eleventy will now search for:

.gitignore in the:

  • project root (directory you ran eleventy from)
  • input directory (for backwards compatibility, although I’d argue this doesn’t make sense to do any more 🤡)

.eleventyignore in the:

  • project root (directory you ran eleventy from)
  • input directory

Ignore 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

@zachleat zachleat self-assigned this Jan 8, 2019
zachleat added a commit to 11ty/11ty-website that referenced this issue Jan 8, 2019
@kleinfreund
Copy link
Contributor

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants