question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

External Named Layout - from package

See original GitHub issue

Describe 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

  1. adder containing the layout.

  2. wrapper in __layout.svelte with 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:closed
  • Created a year ago
  • Reactions:2
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
dummdidummcommented, Apr 5, 2022

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:

<script>
  import Layout, { libraryLoad } from 'package';
  export const load = libraryLoad;
</script>

<Layout>
  <slot />
<Layout>
0reactions
lukaszpolowczykcommented, Apr 5, 2022

@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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to add any specific object's page layout in package.xml?
First .- Make sure that there is a page layout with that name. If there is not one.... there is why you are...
Read more >
Android: Add external project package name into a layout xml?
Try to add the external project as library. In the external project go to project properties and in section Android check the Is...
Read more >
Layout | Metadata API Developer Guide
Feed-based layouts are available on Account, Case, Contact, Lead, Opportunity, custom, and external objects. They include a feed view and a detail view....
Read more >
Package layout conventions - Dart programming language
When you build a pub package, we encourage you to follow the conventions that this page describes. They describe how you organize the...
Read more >
Layouts - Android Developers
Instantiate layout elements at runtime. Your app can create View and ViewGroup objects (and manipulate their properties) programmatically.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found