Get Started: How to Create a KitBook
Warning: This is alpha software and not ready. Watch the updating [Roadmap] for clues on when that will be.
Install the
kitbookpackage:npm i -D kitbook@alphaorpnpm add -D kitbook@alphaAdd the
kitbook()Vite plugin before yoursveltekit()plugin:
vite.config.jsjsimport { sveltekit } from '@sveltejs/kit/vite';import { kitbook } from 'kitbook/plugins/vite';const config = {plugins: [kitbook(),sveltekit(),],};export default config;
- Add these scripts to your
package.json:
json"kitbook": "vite dev --mode kitbook","kitbook:build": "svelte-kit sync && vite build --mode kitbook","kitbook:preview": "vite preview --mode kitbook",
- Run
npm kitbookorpnpm kitbook - Kitbook will quickly [initialize], and then you will want to add an asterisk to
/.svelte-kitin your.gitignorefile to modify it to/.svelte-kit*so the/.svelte-kit-kitbookfolder isn’t committed.
At this point you can open Kitbook and see all your Svelte components, including +page.svelte and +layout.svelte files as they are also just plain Svelte components with a very important data prop.
Next you could…