Skip to content

Commit

Permalink
Add data/svelte hello world
Browse files Browse the repository at this point in the history
  • Loading branch information
ewowi committed Dec 27, 2024
1 parent b487c87 commit 8717049
Show file tree
Hide file tree
Showing 8 changed files with 1,357 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
.pio
node_modules
dist
.vscode
.DS_Store
.idea
26 changes: 26 additions & 0 deletions data/svelte/App.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<script lang="ts">
import Counter from './Counter.svelte'
</script>

<main>
<h1>StarBase + Vite + Svelte</h1>

<div class="card">
<Counter />
</div>

<p>
Check out <a href="https://github.com/sveltejs/kit#readme" target="_blank" rel="noreferrer">SvelteKit</a>, the official Svelte app framework powered by Vite!
</p>

<p class="read-the-docs">
Click on the Vite and Svelte logos to learn more
</p>
</main>

<style>
.read-the-docs {
color: #888;
}
</style>

11 changes: 11 additions & 0 deletions data/svelte/Counter.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<script lang="ts">
let count: number = $state(0)
const increment = () => {
count += 1
}
</script>

<button onclick={increment}>
count is {count}
</button>

26 changes: 26 additions & 0 deletions data/svelte/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<!--
Step 1: hello world
* create minimal app: https://svelte.dev/docs/svelte/getting-started
* vite-plugin-svelte: copy paste the minimal stuff here in folder svelte
* myapp: compare what is here
* goto svelte folder
* npm install
* npm run build create dist folder
* npm run dev -- --open (Live Server)
* compare with other deployments:
* https://github.com/theelims/ESP32-sveltekit : .py to create zipped .html
* https://github.com/BCsabaEngine/svelteesp32
-->

<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Vite + Svelte + TS</title>
</head>
<body>
<div id="app"></div>
<script type="module" src="main.ts"></script>
</body>
</html>
8 changes: 8 additions & 0 deletions data/svelte/main.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { mount } from 'svelte'
import App from './App.svelte'

const app = mount(App, {
target: document.getElementById('app')!,
})

export default app
Loading

0 comments on commit 8717049

Please sign in to comment.