-
-
Notifications
You must be signed in to change notification settings - Fork 432
Reset layout inheritance if there is a _reset.svelte in the directory. #1141
Reset layout inheritance if there is a _reset.svelte in the directory. #1141
Conversation
@@ -145,16 +145,15 @@ export default function create_manifest_data(cwd: string, extensions: string = ' | |||
|
|||
if (item.is_dir) { | |||
const component = find_layout('_layout', `${get_slug(item.file)}__layout`, item.file); | |||
const reset = find_layout('_reset', null, item.file); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about ...
const reset = find_layout('_layout.reset', null, item.file);
...?
Seems to nestle better with our current convention, and you'd know what reset was referring to.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would personally prefer to keep things simple. But if that's a showstopper we can change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
_layout.reset.svelte
is still simple and clear at a glance. If I knew very little about Sapper, that would be convenient and clear.
@joycollector something missing from this would be documentation. Considering adding something to this file: https://github.com/sveltejs/sapper/blob/master/site/content/docs/05-layouts.md |
Good catch. Updated. |
``` | ||
|
||
If in some cases you would like to disable layout inheritance - you can place a file called `_reset.svelte` in the folder. In this case only root layout will be applied. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This isn't quite clear to me. Is _reset.svelte
an empty file? Do you put a new layout in it or if you want additional layout do you place a layout.svelte
alongside it?
@joycollector I know you put some work into this, but after various other discussions about routing, I'm fairly certain we'll be heading in a different direction. We can reopen this if we somehow decide to come back this way. Thanks. |
@arxpoetica what is the new proposed direction please? (I got here and hit this dead end after tracing various conversations through) |
This is just early exploration and will likely change, but conversation has been focused around having configurations somehow, whether it's implemented in the bundle via plugins or somewhere more directly integrated with Sapper itself. Here's a sample RFC, though this is, again, likely to change: sveltejs/rfcs#23 If any of you wish to bikeshed on this, maybe take it up in that RFC. |
Sometimes it is necessary to stop layout inheritance as web page has a different layout but logically needs to be inside this route path.
Example:
/[product]/[model] - Product page
/[produc]/[model]/zoom - Fullscreen page to view the product
According to the discussion in this thread #823 the feature is needed. I do agree with others that the best way would be to put a _reset.svelte file in the folder for which we need to ignore parent layouts.