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

Ability to rename 'pages' directory #5303

Closed
slinkardbrandon opened this issue Sep 26, 2018 · 4 comments
Closed

Ability to rename 'pages' directory #5303

slinkardbrandon opened this issue Sep 26, 2018 · 4 comments

Comments

@slinkardbrandon
Copy link

Feature request

I would love the ability to rename the pages directory, for my case I would like to call it "routes." This would then allow me to use the "route" components (currently pages) as basic wrappers that would essentially just reference a different component. The reason I want this is since Next currently has no intention of supporting the glob pattern under pages I would like to be able to write unit tests and css for my wrapper components.

  • routes/
    -- about.jsx

  • pages/
    -- about/
    ---- about.jsx
    ---- about.spec.jsx
    ---- about.scss

The above structure is what I'm hoping to achieve, of course I could just name "pages" something different like "containers" but I feel as if that could be confusing to future developers on this project. Being able to rename "pages" to "routes" would then free up the name "pages" to use instead of "containers" (frequently used to describe class based components).

Is this something that is possible in Next today? Maybe something that could be implemented?

Thanks for any help!

@slinkardbrandon
Copy link
Author

Note, this is a separate question from the one that is posted over and over about changing the path of pages to be under src or something of the sort, this is specifically about renaming the directory in config.

@timneutkens
Copy link
Member

The interesting part of this is that you could already achieve this without renaming or changing anything in Next.js, by just inverting the structure you want:

pages as the routes, and routes as the implementation.

We're not planning to make pages a configuration option as said in the other issue. There are a few reasons for this but the main reason is that it's an established convention and anyone opening your project that is familiar with Next.js will be able to know everything that is put into pages is immediately public. By changing this, for example to routes, you're potentially introducing confusion.

@timneutkens
Copy link
Member

Posted #8451

@balazsorban44
Copy link
Member

This issue has been automatically locked due to no recent activity. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.

@vercel vercel locked as resolved and limited conversation to collaborators Jan 31, 2022
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

3 participants