router
This feature can be useful to group related pages into the same folder without adding additional segments to the URL.
For the following structure:
app
/routes
/(auth)
login.ts
signup.ts
we'll be able to access the login
and signup
pages by using /login
and /signup
URLs. In the same way, we should be able to define a layout/shell component for pages in the (auth)
folder:
app
/routes
/(auth)
login.ts
signup.ts
(auth).ts
Pathless layout routes in Remix: https://remix.run/docs/en/v1/guides/routing#pathless-layout-routes
No response
@brandonroberts I actually ran into this today. I was trying to put components that were only used in a specific route in the same folder as the route. Similar to what you describe or what the Remix docs describe here: https://remix.run/docs/en/v1/file-conventions/route-files-v2#folders-for-organization
I would absolutely this as a new feature!
@brandonroberts are you planning on creating an RFC for hiding co-located in the routes folders? Or even better, are you already working on adding this feature?
I updated the issue description - instead of two underscores (/__auth
), we can use round brackets /(auth)
for consistency because we already support this syntax for pathless routes. Thoughts?
@goetzrobin I haven't but I'll create one for the ability to co-locate files within the routes folder. You're welcome to create one also if you already have a use case.
@markostanimirovic I like it for the consistency. My other thought is it might be confusing if we want to support aux routes in the future that use the parenthesis in the URL.
We could probably define those as /path(outlet-name) with /(path) being used for pathless routes.
@markostanimirovic I like it for the consistency. My other thought is it might be confusing if we want to support aux routes in the future that use the parenthesis in the URL.
In case we want to support auxiliary routes, it may make sense to do a breaking change and use the __
prefix instead of brackets for all pathless routes.
@markostanimirovic I like it for the consistency. My other thought is it might be confusing if we want to support aux routes in the future that use the parenthesis in the URL.
In case we want to support auxiliary routes, it may make sense to do a breaking change and use the
__
prefix instead of brackets for all pathless routes.
You're saying define pathless routes as __index.ts instead of index.ts or (index.ts)?
I'd prefer to keep those as is and come up with a different convention for aux routes as they are much more niche in terms of usage.
You're saying define pathless routes as __index.ts instead of index.ts or (index.ts)?
Actually index.ts
would remain the same and named pathless routes would change - (home).ts
-> __home.ts
.
I'd prefer to keep those as is and come up with a different convention for aux routes as they are much more niche in terms of usage.
Agree.
Owner Name | analogjs |
Repo Name | analog |
Full Name | analogjs/analog |
Language | TypeScript |
Created Date | 2022-07-06 |
Updated Date | 2023-03-28 |
Star Count | 885 |
Watcher Count | 18 |
Fork Count | 67 |
Issue Count | 33 |
Issue Title | Created Date | Updated Date |
---|