External Named Layout - from package
See original GitHub issueDescribe the problem
The new __layout@name.svelte syntax looks cool.
I have a thought to expand or refute: Support for a layout, loaded externally, from a package.
Describe the proposed solution
You install the npm i packagename package that contains the layout file.
You use this layout via the package name, for example: __layout@packagename.svelte.
That’s it. 😃
You could also add a built-in, external layout in SvelteKit, e.g. to reset __layout-reset.svelte:
Then use for reset __layout@reset.svelte, so you won’t need to create an empty __layout-root.svelte, containing the <slot/> itself (as recommended in the SvelteKit documentation).
Alternatives considered
-
adder containing the layout.
-
wrapper in
__layout.sveltewith imported component:
<script>.
Import packagename from "packagename";
</script>
<Packagename><slot/></Packagename>
…Such a thing doesn’t work, because in Packagename you can’t, for example, provide a load function.
Importance
would make my life easier
Additional Information
Such a thing would be part of a broader thinking about external modules, as related - https://github.com/sveltejs/kit/issues/3723
Issue Analytics
- State:
- Created a year ago
- Reactions:2
- Comments:5 (5 by maintainers)

Top Related StackOverflow Question
Closing as it sounds we agree that this is too specific to be worth the additional maintenance, and the “workaround” is to just import the package’s component, together with a library-provided load function and do something like this:
@Rich-Harris Well tough, at least I got the idea out of my head. I don’t have any better arguments to convince you of this idea.