Skip to content

Commit 57e1361

Browse files
committed
Prepare release
1 parent 3a7005b commit 57e1361

File tree

2 files changed

+18
-15
lines changed

2 files changed

+18
-15
lines changed

.changeset/thin-dots-share.md

-6
This file was deleted.

CHANGELOG.md

+18-9
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,21 @@
11
# @ceteio/next-layout-loader
22

3+
## 2.0.0
4+
5+
### Major Changes
6+
7+
- 3a7005b:
8+
- Only require magic in `pages/_app`, not in every route file.
9+
- Removed `options.layoutsDir`. `_layout` files must now always be in `pages/`.
10+
311
## 1.0.0
12+
413
### Major Changes
514

615
- Initial release.
7-
16+
817
Add `_layout.tsx` files with default exports in your `pages/` directory:
9-
18+
1019
```
1120
pages
1221
├── dashboard
@@ -17,9 +26,9 @@
1726
├── _layout.tsx
1827
└── index.tsx
1928
```
20-
29+
2130
For example:
22-
31+
2332
```javascript
2433
// pages/_layout.tsx
2534
export default function Layout({ children }) {
@@ -32,20 +41,20 @@
3241
</div>
3342
);
3443
}
35-
44+
3645
// To hide this layout component from the router / build pipeline
3746
export const getStaticProps = async () => ({ notFound: true });
3847
```
39-
48+
4049
Next, load the layout component with
4150
[`preval`](https://github.com/kentcdodds/babel-plugin-preval) &
4251
[`codegen`](https://github.com/kentcdodds/babel-plugin-codegen):
43-
52+
4453
```javascript
4554
// pages/dashboard/user/index.tsx
4655
const filename = preval`module.exports = __filename`;
4756
const Layout = codegen.require("@ceteio/next-layout-loader", filename);
48-
57+
4958
export default function User() {
5059
return (
5160
<Layout>
@@ -54,7 +63,7 @@
5463
);
5564
}
5665
```
57-
66+
5867
Now, `<Layout>` is a composition of all `_layout.tsx` files found in the
5968
`pages/` directory from the current file, up to the root (ie;
6069
`pages/dashboard/user/_layout.tsx`, `pages/dashboard/_layout.tsx`, and

0 commit comments

Comments
 (0)