✨Svelteway Re-Imagined: New Svelteway Products & Services Coming Soon!

Installation

The easiest way to start building a SvelteWay app is to run npm create:

npm create svelteway@latest my-app
cd my-app
npm install
npm run dev

Manual Setup

Setup SvelteWay on your existing SvelteKit application.

npm install -D svelteway

Make sure you have configured Tailwind CSS and Daisy UI on your project.

src/routes/+layout.server.ts
// ...
import type { LayoutServerLoad } from './$types'
import { cwd } from 'process'
import fs from 'node:fs'
export const load = (async ({ route }) => {
// ...
  const currentDirectory = cwd()
  const fileToRead = route.id == '/'
? `${currentDirectory}/src/routes/+page.svelte`
  : `${currentDirectory}/src/routes/${route.id}/+page.svelte`
  const themeFile = `${currentDirectory}/static/theme.txt`
  const themeContent = await fs.promises.readFile(themeFile)
  const content = await fs.promises.readFile(fileToRead)
  return {
    data: {
// ...
      source: content.toString('utf8'),
      file: fileToRead,
      theme: JSON.stringify(themeContent.toString('utf8'))
    }
  };
}) satisfies LayoutServerLoad;
src/routes/+layout.svelte
<script>
	// ...
	import '../app.css'
	import { Layout } from 'svelteway'
	export let data;
	const theme = JSON.parse(data.data.theme)
</script>
<Layout {data}>
	// ...
<div data-theme={theme}>
	<slot />
</div>
</Layout>
package.json
// Update scripts
"dev": "svelteway dev && vite dev",
"build": "svelteway build && vite build"
// ...