svelte-on-bits-demo Svelte Themes

Svelte On Bits Demo

Svelte on Bits demo

This project was generated using the Bits Svelte frontend Getting started page

Install Bit version manager (bvm)

yarn global add @teambit/bvm

Install bit CLI

bvm install

Create bit workspace for svelte project

bit new basic my-svelte-workspace

Enter workspace

cd my-svelte-workspace

Open in your IDE of choice

code .
bit templates

The following template(s) are available with the command bit create:
Example - bit create <template-name> <component-name>
svelte (frontend.svelte/svelte-env)
    svelte (a svelte component template)
    svelte-env (set up your own custom svelte env using this template)
    svelte-app (a template for generating svelte app components)

find and add templates in https://bit.dev/reference/generator/use-component-generator

Add a svelte component

bit create svelte my-svelte-component

Add a svelte app

bit create svelte-app my-svelte-app

Start local Bit dev server

bit start

Go to localhost:3000

Notice how the component is imported and used in the Svelte app:

<script>
    import { MySvelteComponent } from '@org/scope.my-svelte-component';
    export let name;
</script>

<main>
    <h1>Hello {name}!</h1>
    <p>Visit the <a href="https://svelte.dev/tutorial">Svelte tutorial</a> to learn how to build Svelte apps.</p>
    <MySvelteComponent
    name="some name"
    />
</main>

Top categories

Loading Svelte Themes