how to handle reset layout?

Viewed 1820

I'm now getting this error:

__layout.reset has been removed in favour of named layouts: https://kit.svelte.dev/docs/layouts#named-layouts

I have a sub-directory for which I do not want to inherit the base layout.

$ find . -name '*layout*'               
./setup-profile/__layout.reset.svelte
./auth/__layout.reset.svelte
./__layout.svelte

package.json has

    "@sveltejs/kit": "next",
3 Answers

The doc page you linked is pretty self-explanatory.

Edit:

Overall the simpler way is to create a named reset layout at the root of your source tree containing a simple <slot />, and reference that layout whenever you want to start from a reset layout:

src/routes/
├ auth/
│ ├ __layout@reset.svelte (will inherit from the reset layout)
│ ├ pageA.svelte
│ └ pageB.svelte
├ setup-profile/
│ ├ __layout@reset.svelte (will inherit from the reset layout)
│ ├ pageA.svelte
│ └ pageB.svelte
├ no-reset/
│ ├ __layout.svelte (will inherit from the base layout)
│ ├ pageA.svelte
│ └ pageB.svelte
├ __layout.svelte
└ __layout-reset.svelte

According to my test, you need to rename layout & the file use layout.

e.g

l2_named/
    __layout-foo.svelte
    level_2_named@foo.svelte

The layout file added -foo, and the file use layout added @foo.

i recommed you using (group), may this help you

read more

Related