Change default inputDirectory from '.' to 'src' #4118
Replies: 15 comments
|
In my case, I call the input directory |
100% agree with this. That said: my immediate reaction is that this would be a huge breaking change. It would break every project that didn’t specify an input directory explicitly! We may have to chalk this one up to “I wish I had done it differently,” unfortunately. |
|
Let’s add some docs around this to encourage folks into a better path. I know Specifically: |
Eleventy 3.0 broke my blog pretty substantially, I had to rewrite my configs, and that was just recently. I think you'd be forgiven for one more breaking change. Maybe you could have some upgrade notes like "Moving from 3.1 to 3.2: the default input directory has changed to |
|
I would imagine anyone upgrading to Eleventy 4.0.0 would assume there may be breaking changes according to common SemVer versioning patterns, if you really want to implement this. |
|
I suppose we could do something like |
Isn't dealing with breaking changes what major revisions like 4.0.0 are for? And while I have only this poll on Discord to support this... The update helper for v4.0.0 should be able to detect default input folder use and at the very least give good advice on how to update your project. |
For me semver isn’t just a “change anything you want” as long as you bump a major. I typically weigh the cost/benefit of any breaking change to make sure it isn’t hurting more than it helps (with a mind for cost/benefit being different across both app developers and Eleventy maintainers) |
|
Personally, I am inclined to agree with Zach on this one: while it is odd, and perhaps regrettable, that the default directories place the output directory inside the input directory, I haven’t yet seen any compelling reasons to change the defaults and break any projects out there that are just using the default input directory.
I’m not quite sure why Off the top of my head, the only file I can think of that would typically be in a project and need to be added to
If it is the case that complex projects change the input directory, then they won’t benefit in any way from a change to the defaults. They might choose to remove any settings that duplicate the new defaults, but that doesn’t seem like a huge win to me. Meanwhile, any projects that are using the current defaults will have to “fix” their projects when they upgrade — either by adding settings to keep Making a change to the defaults most benefits people starting new projects, as existing projects already have the configuration in place to make their projects work. But again, I don’t think I’ve seen any clear explanation of the tangible benefits of this change. I’ve made projects with a variety of configurations for Eleventy’s directory structure, including just sticking with the defaults, and I haven’t really found any differences beyond an aesthetic preference for how my project is organized. |
|
I wasn't aware that eleventy already uses your .gitignore! That's unexpected behavior but probably the right call in many cases. I'll try reproducing the site-inside-site thing again later but if that's no longer an issue then I agree, leave the current default behavior but make it clear in the docs that it can be changed. |
|
Preview of getting started guide (with a |
|
Added some additional copy to https://11ty-website-git-eleventy-3955-11ty.vercel.app/docs/config/#input-directory |
|
@zachleat Another thought on this, and a possible way to move it forward and retain backwards compatibility. In version 4.0 If That way going forward over time we move to a source directory as default, but don't break backwards compatibility. Maybe depreciate There would be an (fairly unlikely to occur) issue if someone has a project using Could that work? |
|
Moving this to the enhancement queue per https://www.11ty.dev/blog/github-issues/ |

Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Is your feature request related to a problem? Please describe.
The current behavior of Eleventy for new projects is to treat the entire working directory as the "input directory". This directory contains lots of files that need to be ignored, like
node_modulesand.gitignoreand_site.That last one is a footgun! See #2410.
I don't think I've ever used Eleventy for anything, big or small, without changing the default input directory. I think that, maybe, the default input directory is wrong.
Describe the solution you'd like
Instead of defaulting to the current directory, it should default to
src. In particular, the default input directory should not contain the default output directory.Describe alternatives you've considered
Currently I add this to every new project I create:
Given that this is is a no-brainer thing that every project should have: I think it should be the default.
Additional context
No response
All reactions