-
Notifications
You must be signed in to change notification settings - Fork 10.3k
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
Having a src
directory as the root of all source files
#814
Comments
So @fabien0102 has been working on this exact issue actually #802 and we've been discussing this in Discord. My main problem with his PR has been the idea of adding another configuration option as every bit of configuration has a very high cost — sometimes costs you don't realize until down the road when a configuration option adds all sorts of complexity to adding a new feature or event prevents the new feature from being added altogether. So no new configuration options unless they're super high value. Which... setting a different root directory isn't. But his and your's arguments are persuasive that it'd be a lot simpler if all site src code was gathered under one directory. So here's a proposed directory structure:
Thoughts? |
That is pretty much exactly the structure I would have proposed 😄 Glad you see value in this also. |
I consider the use of a
src
directory a pretty useful convention. Is there a particular reason you choose to not have that structure for Gatsby? It seems a bit clumsy to me having all these different source directories directly in the root of the project.A src directory makes certain configurations easier to manage since sources are clearly separated from config files, static asset or data and node-modules and such. For example having webpack resolve all directories in src for easy import statements, or running some tool like
prettier-eslint
over all js files.Right now I was trying to do just that, and
prettier-eslint
appears to have a bug where it's not respecting the.eslintignore
contents correctly, munching away on my node-modules directory.When using GraphQL to serve data from files which are fetched from an external API, I would expect those files to live in a location like
data
next tosrc
, indicating that that might not be part of the repository.Maybe you have your reasons. I'm curious to know.
The text was updated successfully, but these errors were encountered: