Import a component into another component

Hi. first of all, i love the concept, hope it gets traction :slight_smile:
But I’m failing to make it replace the usual workflow when developing svelte apps, for example imagine you create a component that you want to keep referencing through out the site (logo on the footer, logo on the header etc).
Sorry if it is a stupid example, just to give an idea of what I mean.

How do you reference them? I would import Logo from "./components/Logo.svelte" but i don’t know where the components, we create with Primo, are stored.

Thanks for the help.

1 Like

Hey Jorge!

You can’t import one component into another like that. If you wanted to have some reusable Svelte components that you could import across your Primo components, you’d have to publish them as an npm package and them import them that way.

Also - I wouldn’t recommend using Primo to make Svelte apps. SvelteKit is a lot more powerful and pretty approachable too. Primo’s really best for building content sites like landing pages, portfolios, brochure sites, stuff like that. I’m hoping to add a way to integrate Primo into SvelteKit soon though so you can use them both together in the same codebase - i.e. SvelteKit for all the app stuff and Primo for the marketing pages.

Thanks for the reply, indeed that’s a solution but a bit overwhelming one (not complaining, just thinking out loud). My initial misunderstanding was that if I can create a component with a typical svelte html/css/js structure, that it would be somehow stored as ComponentName.svelte within the Primo dev env, so that I could reference it by pointing to its local path.

Btw When I said svelte app I meant small marketing site built with svelte, so I’m already using svelte but have no easy way to manage its content (looking for tools that would help me transition to sveltekit quicker as well as help with the content part, and found primo)

Either way, I’ll try to think of workarounds, maybe would there be a way to reference a raw GitHub url to the import, instead of having to publish it to npm :thinking: ?

That might work actually! Would be interested to know if you try it - might do that for my own sites since uploading to a repo is easier than publishing to npm.