Skip to content

Commit 9cb06c3

Browse files
docs: add explanation of ignoredRouteFiles option to guide (#12625)
* docs: add explanation of `ignoredRouteFiles` option to guide * Update docs/how-to/file-route-conventions.md --------- Co-authored-by: Brooks Lybrand <[email protected]>
1 parent caebeb2 commit 9cb06c3

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

docs/how-to/file-route-conventions.md

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,18 @@ import { flatRoutes } from "@react-router/fs-routes";
2323
export default flatRoutes() satisfies RouteConfig;
2424
```
2525

26+
Any modules in the `app/routes` directory will become routes in your application by default.
27+
The `ignoredRouteFiles` option allows you to specify files that should not be included as routes:
28+
29+
```tsx filename=app/routes.ts
30+
import { type RouteConfig } from "@react-router/dev/routes";
31+
import { flatRoutes } from "@react-router/fs-routes";
32+
33+
export default flatRoutes({
34+
ignoredRouteFiles: ["home.tsx"],
35+
}) satisfies RouteConfig;
36+
```
37+
2638
This will look for routes in the `app/routes` directory by default, but this can be configured via the `rootDirectory` option which is relative to your app directory:
2739

2840
```tsx filename=app/routes.ts
@@ -38,7 +50,7 @@ The rest of this guide will assume you're using the default `app/routes` directo
3850

3951
## Basic Routes
4052

41-
Any modules in the `app/routes` directory will become routes in your application. The filename maps to the route's URL pathname, except for `_index.tsx` which is the [index route][index_route] for the [root route][root_route]. You can use `.js`, `.jsx`, `.ts` or `.tsx` file extensions.
53+
The filename maps to the route's URL pathname, except for `_index.tsx` which is the [index route][index_route] for the [root route][root_route]. You can use `.js`, `.jsx`, `.ts` or `.tsx` file extensions.
4254

4355
```text lines=[3-4]
4456
app/

0 commit comments

Comments
 (0)