Skip to content

Commit e8066c0

Browse files
committed
update readme
1 parent 60df246 commit e8066c0

File tree

2 files changed

+38
-26
lines changed

2 files changed

+38
-26
lines changed

packages/v1-meta/README.md

Lines changed: 23 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,32 @@
11
# V1 Meta
22

33
```tsx
4-
import { metaV1 } from "@remix-run/v1-meta";
4+
import { metaV1, getMatchesData } from "@remix-run/v1-meta";
55

6-
export function meta(args) {
6+
export const meta = (args) => {
7+
// In the v1 API, `meta` received a `parentsData` argument, which is an
8+
// object keyed by each parent route ID containing the data returned by
9+
// that route's `loader` function. This argument is removed from the
10+
// v2 API. `getMatchesData` will construct an object with the same
11+
// signature, allowing you to easily refactor your code.
12+
let matchesData = getMatchesData(args);
13+
let rootData = matchesData["root"];
14+
15+
// This function will construct an array of `V2_MetaDescriptor` objects.
16+
// It will use the same heuristics as Remix v1 to merge the parent
17+
// route's meta values with the data you provide.
718
return metaV1(args, {
819
title: "My App",
920
description: "My App Description",
1021
});
11-
// return [
12-
// { charSet: "utf-8" }, // inherited!
13-
// { title: "My App" },
14-
// { name: "description", content: "My App Description" },
15-
// ];
16-
}
22+
23+
// output:
24+
return [
25+
// This is inherited from the parent route!
26+
{ charSet: "utf-8" },
27+
// If your parent has a title it will be overridden!
28+
{ title: "My App" },
29+
{ name: "description", content: "My App Description" },
30+
];
31+
};
1732
```

packages/v1-route-convention/README.md

Lines changed: 15 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,19 @@
44
// remix.config.js
55
const { createRoutesFromFolders } = require("@remix-run/v1-route-convention");
66

7-
// tell Remix to ignore everything in the routes directory
8-
// we'll let `createRoutesFromFolders` take care of that
9-
exports.ignoredRouteFiles = ["**/*"];
10-
exports.routes = (defineRoutes) => createRoutesFromFolders(defineRoutes);
11-
```
12-
13-
> **Note**
14-
> If you're already using `ignoredRouteFiles` you can move that to the plugin to keep using it
15-
16-
```diff
17-
// remix.config.js
18-
const { createRoutesFromFolders } = require("@remix-run/v1-route-convention");
19-
20-
- exports.ignoredRouteFiles = ["**/.*"];
21-
+ exports.ignoredRouteFiles = ["**/*"];
22-
+ exports.routes = (defineRoutes) => createRoutesFromFolders(defineRoutes, {
23-
+ ignoredFilePatterns: ["**/.*"]
24-
+ });
7+
/** @type {import('@remix-run/dev').AppConfig} */
8+
module.exports = {
9+
// Tell Remix to ignore everything in the routes directory.
10+
// We'll let `createRoutesFromFolders` take care of that.
11+
ignoredRouteFiles: ["**/*"],
12+
routes: (defineRoutes) => {
13+
// `createRoutesFromFolders` will create routes for all files in the
14+
// routes directory using the same default conventions as Remix v1.
15+
return createRoutesFromFolders(defineRoutes, {
16+
// If you're already using `ignoredRouteFiles` in your Remix config,
17+
// you can move them to `ignoredFilePatterns` in the plugin's options.
18+
ignoredFilePatterns: ["**/.*", "**/*.css"],
19+
});
20+
},
21+
};
2522
```

0 commit comments

Comments
 (0)