Skip to content
This repository has been archived by the owner on Mar 23, 2023. It is now read-only.

Enhancement: use usesSrc when determining layoutPath #82

Open
benedfit opened this issue Aug 28, 2020 · 7 comments
Open

Enhancement: use usesSrc when determining layoutPath #82

benedfit opened this issue Aug 28, 2020 · 7 comments

Comments

@benedfit
Copy link

Thank you so much for adding the ability to have pages under src/pages. However, I also have my layouts under src/layout, so I'm currently configuring the plugin like so:

{ layoutPath: './src/layouts', usesSrc: true }

Would it possible to automatically assume that layoutPath equals src/layouts if the project is using src/pages?

@jescalan
Copy link
Contributor

Hmm, I'd love to get some feedback on this from those who use src, since I don't personally. I can see the argument for it making sense, but I can also see this being something that is surprising "magic" functionality, and we'd prefer to force users to be explicit with the path. Maybe @johnforte would have some thoughts here?

@benedfit
Copy link
Author

From my personal experience; when using Next.js and putting things under src, I end up putting everything under there e.g. https://github.com/newhighsco/website/tree/master/src

The Next.js docs seem to allude to the fact that this is likely what others do to: https://nextjs.org/docs/advanced-features/src-directory

Look forward to hearing what others say

@johnforte
Copy link
Contributor

@jescalan my pull request makes it clear that I am on board with this change 😄 since nextjs makes the assumption that src will hold all source code like pages, I believe we can make that same assumption.

@benedfit
Copy link
Author

benedfit commented Aug 28, 2020

On a side note, I actually ran into issues setting './src/layout' for layoutPath, that don't occur when it's set to 'src/layout'. getStaticProps couldn't be exported from my layouts when I used the dot-notation

@jescalan
Copy link
Contributor

Sounds reasonable to me - @benedfit would you be interested in submitting a PR for this change? 😀

@jescalan
Copy link
Contributor

Ah never mind, looks like @johnforte has got it covered! will get this out soon

@ecklf
Copy link

ecklf commented Sep 19, 2020

I'd love to get some feedback on this

I am using src and was confused why usesSrc doesn't behave like the suggested change above 👍

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

No branches or pull requests

4 participants