SvelteKit + shadcn-svelte starter
SvelteKit, shadcn-svelte, SEO, Vitest. A tested combination you can create in one command and keep extending.
$ npm create pickstack@latest my-app -- --framework sveltekit --modules tailwind,shadcn-svelte,seo,vitest,eslint,prettier --yesCustomize in the configurator
Packages
| Package | Version | Type |
|---|---|---|
@eslint/js | ^10.0.1 | dev |
@fontsource-variable/inter | ^5.3.0 | dev |
@tailwindcss/vite | ^4.3.5 | dev |
cn | ^0.5.2 | dev |
eslint | ^10.15.0 | dev |
eslint-config-prettier | ^10.1.8 | dev |
eslint-plugin-svelte | ^3.24.1 | dev |
globals | ^17.14.0 | dev |
jsdom | ^31.0.1 | dev |
prettier | ^3.10.1 | dev |
prettier-plugin-svelte | ^4.2.0 | dev |
shadcn-svelte | ^1.8.1 | dev |
tailwind-variants | ^3.3.0 | dev |
tailwindcss | ^4.3.5 | dev |
tw-animate-css | ^1.4.0 | dev |
typescript-eslint | ^8.74.0 | dev |
vitest | ^5.1.1 | dev |
New files
dist .svelte-kit build pnpm-lock.yaml package-lock.json yarn.lock bun.lock
{
"plugins": ["prettier-plugin-svelte"],
"overrides": [
{
"files": "*.svelte",
"options": {
"parser": "svelte"
}
}
]
}
{
"$schema": "https://shadcn-svelte.com/schema.json",
"tailwind": {
"css": "src/routes/layout.css",
"baseColor": "neutral"
},
"aliases": {
"components": "#lib/components",
"utils": "#lib/utils",
"ui": "#lib/components/ui",
"hooks": "#lib/hooks",
"lib": "#lib"
},
"typescript": true,
"registry": "https://shadcn-svelte.com/registry",
"style": "vega",
"iconLibrary": "lucide",
"menuColor": "default",
"menuAccent": "subtle"
}
import path from "node:path";
import js from "@eslint/js";
import { defineConfig, includeIgnoreFile } from "eslint/config";
import eslintConfigPrettier from "eslint-config-prettier/flat";
import svelte from "eslint-plugin-svelte";
import globals from "globals";
import ts from "typescript-eslint";
const gitignorePath = path.resolve(import.meta.dirname, ".gitignore");
export default defineConfig(
includeIgnoreFile(gitignorePath),
js.configs.recommended,
ts.configs.recommended,
svelte.configs.recommended,
eslintConfigPrettier,
svelte.configs.prettier,
{
languageOptions: {
parserOptions: { extraFileExtensions: [".svelte"] },
globals: { ...globals.browser, ...globals.node },
},
rules: {
// typescript-eslint recommends turning no-undef off in TypeScript projects:
// https://typescript-eslint.io/troubleshooting/faqs/eslint/#i-get-errors-from-the-no-undef-rule-about-global-variables-not-being-defined-even-though-there-are-no-typescript-errors
"no-undef": "off",
},
},
{
files: ["**/*.svelte", "**/*.svelte.ts", "**/*.svelte.js"],
languageOptions: {
parserOptions: { projectService: true, parser: ts.parser },
},
},
{
// shadcn-svelte's Button renders whatever `href` it receives; callers pass resolve()d paths.
files: ["src/lib/components/ui/**/*.svelte"],
rules: { "svelte/no-navigation-without-resolve": "off" },
},
);
import { defineEnvVars } from "@sveltejs/kit/env";
export const variables = defineEnvVars({
SITE_URL: {
public: true,
static: true,
description: "Public origin of the site, without trailing slash",
schema: (value) => value ?? "https://example.com",
},
});
<script lang="ts" module>
import type {
HTMLAnchorAttributes,
HTMLButtonAttributes,
} from "svelte/elements";
import { tv, type VariantProps } from "tailwind-variants";
import { cn, type WithElementRef } from "#lib/utils.js";
export const buttonVariants = tv({
base: "focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:aria-invalid:border-destructive/50 rounded-md border border-transparent bg-clip-padding text-sm font-medium focus-visible:ring-3 aria-invalid:ring-3 active:not-aria-[haspopup]:translate-y-px [&_svg:not([class*='size-'])]:size-4 group/button inline-flex shrink-0 items-center justify-center whitespace-nowrap transition-all outline-none select-none disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0",
variants: {
variant: {
default: "bg-primary text-primary-foreground hover:bg-primary/80",
outline:
"border-border bg-background hover:bg-muted hover:text-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50 aria-expanded:bg-muted aria-expanded:text-foreground shadow-xs",
secondary:
"bg-secondary text-secondary-foreground hover:bg-[color-mix(in_oklch,var(--secondary),var(--foreground)_5%)] aria-expanded:bg-secondary aria-expanded:text-secondary-foreground",
ghost:
"hover:bg-muted hover:text-foreground dark:hover:bg-muted/50 aria-expanded:bg-muted aria-expanded:text-foreground",
destructive:
"bg-destructive/10 hover:bg-destructive/20 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/20 text-destructive focus-visible:border-destructive/40 dark:hover:bg-destructive/30",
link: "text-primary underline-offset-4 hover:underline",
},
size: {
default:
"h-9 gap-1.5 px-2.5 in-data-[slot=button-group]:rounded-md has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",
xs: "h-6 gap-1 rounded-[min(var(--radius-md),8px)] px-2 text-xs in-data-[slot=button-group]:rounded-md has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3",
sm: "h-8 gap-1 rounded-[min(var(--radius-md),10px)] px-2.5 in-data-[slot=button-group]:rounded-md has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5",
lg: "h-10 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",
icon: "size-9",
"icon-xs":
"size-6 rounded-[min(var(--radius-md),8px)] in-data-[slot=button-group]:rounded-md [&_svg:not([class*='size-'])]:size-3",
"icon-sm":
"size-8 rounded-[min(var(--radius-md),10px)] in-data-[slot=button-group]:rounded-md",
"icon-lg": "size-10",
},
},
defaultVariants: {
variant: "default",
size: "default",
},
});
export type ButtonVariant = VariantProps<typeof buttonVariants>["variant"];
export type ButtonSize = VariantProps<typeof buttonVariants>["size"];
export type ButtonProps = WithElementRef<HTMLButtonAttributes> &
WithElementRef<HTMLAnchorAttributes> & {
variant?: ButtonVariant;
size?: ButtonSize;
};
</script>
<script lang="ts">
let {
class: className,
variant = "default",
size = "default",
ref = $bindable(null),
href = undefined,
type = "button",
disabled,
children,
...restProps
}: ButtonProps = $props();
</script>
{#if href}
<a
bind:this={ref}
data-slot="button"
class={cn(buttonVariants({ variant, size }), className)}
href={disabled ? undefined : href}
aria-disabled={disabled}
role={disabled ? "link" : undefined}
tabindex={disabled ? -1 : undefined}
{...restProps}
>
{@render children?.()}
</a>
{:else}
<button
bind:this={ref}
data-slot="button"
class={cn(buttonVariants({ variant, size }), className)}
{type}
{disabled}
{...restProps}
>
{@render children?.()}
</button>
{/if}
import Root, {
type ButtonProps,
type ButtonSize,
type ButtonVariant,
buttonVariants,
} from "./button.svelte";
export {
type ButtonProps as Props,
type ButtonProps,
type ButtonSize,
type ButtonVariant,
buttonVariants,
Root,
//
Root as Button,
};
<script lang="ts">
import type { HTMLAttributes } from "svelte/elements";
import { cn, type WithElementRef } from "#lib/utils.js";
let {
ref = $bindable(null),
class: className,
children,
...restProps
}: WithElementRef<HTMLAttributes<HTMLDivElement>> = $props();
</script>
<div
bind:this={ref}
data-slot="card-action"
class={cn(
"col-start-2 row-span-2 row-start-1 self-start justify-self-end",
className,
)}
{...restProps}
>
{@render children?.()}
</div>
<script lang="ts">
import type { HTMLAttributes } from "svelte/elements";
import { cn, type WithElementRef } from "#lib/utils.js";
let {
ref = $bindable(null),
class: className,
children,
...restProps
}: WithElementRef<HTMLAttributes<HTMLDivElement>> = $props();
</script>
<div
bind:this={ref}
data-slot="card-content"
class={cn("flex flex-col gap-3 px-(--card-spacing)", className)}
{...restProps}
>
{@render children?.()}
</div>
<script lang="ts">
import type { HTMLAttributes } from "svelte/elements";
import { cn, type WithElementRef } from "#lib/utils.js";
let {
ref = $bindable(null),
class: className,
children,
...restProps
}: WithElementRef<HTMLAttributes<HTMLParagraphElement>> = $props();
</script>
<p
bind:this={ref}
data-slot="card-description"
class={cn("text-muted-foreground text-sm", className)}
{...restProps}
>
{@render children?.()}
</p>
<script lang="ts">
import type { HTMLAttributes } from "svelte/elements";
import { cn, type WithElementRef } from "#lib/utils.js";
let {
ref = $bindable(null),
class: className,
children,
...restProps
}: WithElementRef<HTMLAttributes<HTMLDivElement>> = $props();
</script>
<div
bind:this={ref}
data-slot="card-footer"
class={cn(
"rounded-b-xl px-(--card-spacing) [.border-t]:pt-(--card-spacing) flex items-center",
className,
)}
{...restProps}
>
{@render children?.()}
</div>
<script lang="ts">
import type { HTMLAttributes } from "svelte/elements";
import { cn, type WithElementRef } from "#lib/utils.js";
let {
ref = $bindable(null),
class: className,
children,
...restProps
}: WithElementRef<HTMLAttributes<HTMLDivElement>> = $props();
</script>
<div
bind:this={ref}
data-slot="card-header"
class={cn(
"gap-1 rounded-t-xl px-(--card-spacing) [.border-b]:pb-(--card-spacing) group/card-header @container/card-header grid auto-rows-min items-start has-data-[slot=card-action]:grid-cols-[1fr_auto] has-data-[slot=card-description]:grid-rows-[auto_auto]",
className,
)}
{...restProps}
>
{@render children?.()}
</div>
<script lang="ts">
import type { HTMLAttributes } from "svelte/elements";
import { cn, type WithElementRef } from "#lib/utils.js";
let {
ref = $bindable(null),
class: className,
children,
...restProps
}: WithElementRef<HTMLAttributes<HTMLDivElement>> = $props();
</script>
<div
bind:this={ref}
data-slot="card-title"
class={cn(
"text-base leading-normal font-medium group-data-[size=sm]/card:text-sm",
className,
)}
{...restProps}
>
{@render children?.()}
</div>
<script lang="ts">
import type { HTMLAttributes } from "svelte/elements";
import { cn, type WithElementRef } from "#lib/utils.js";
let {
ref = $bindable(null),
class: className,
children,
size = "default",
...restProps
}: WithElementRef<HTMLAttributes<HTMLDivElement>> & {
size?: "default" | "sm";
} = $props();
</script>
<div
bind:this={ref}
data-slot="card"
data-size={size}
class={cn(
"ring-foreground/10 bg-card text-card-foreground gap-(--card-spacing) overflow-hidden rounded-xl py-(--card-spacing) text-sm shadow-xs ring-1 [--card-spacing:--spacing(6)] has-[>img:first-child]:pt-0 data-[size=sm]:[--card-spacing:--spacing(4)] *:[img:first-child]:rounded-t-xl *:[img:last-child]:rounded-b-xl group/card flex flex-col",
className,
)}
{...restProps}
>
{@render children?.()}
</div>
import Root from "./card.svelte";
import Action from "./card-action.svelte";
import Content from "./card-content.svelte";
import Description from "./card-description.svelte";
import Footer from "./card-footer.svelte";
import Header from "./card-header.svelte";
import Title from "./card-title.svelte";
export {
Action,
Action as CardAction,
Content,
Content as CardContent,
Description,
Description as CardDescription,
Footer,
Footer as CardFooter,
Header,
Header as CardHeader,
Root,
//
Root as Card,
Title,
Title as CardTitle,
};
import { flushSync, mount, unmount } from "svelte";
import { describe, expect, it } from "vitest";
import Counter from "./Counter.svelte";
describe("Counter", () => {
it("increments when +1 is clicked", () => {
const component = mount(Counter, { target: document.body });
const plus = [...document.querySelectorAll("button")].find(
(b) => b.textContent?.trim() === "+1",
);
plus?.click();
flushSync();
expect(document.querySelector("p")?.textContent).toBe("1");
unmount(component);
});
});
export { cn } from "cn";
// eslint-disable-next-line @typescript-eslint/no-explicit-any
export type WithoutChild<T> = T extends { child?: any } ? Omit<T, "child"> : T;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
export type WithoutChildren<T> = T extends { children?: any }
? Omit<T, "children">
: T;
export type WithoutChildrenOrChild<T> = WithoutChildren<WithoutChild<T>>;
export type WithElementRef<T, U extends HTMLElement = HTMLElement> = T & {
ref?: U | null;
};
import { SITE_URL } from "$app/env/public";
export const prerender = true;
export function GET() {
const body = `User-agent: *
Allow: /
Sitemap: ${SITE_URL}/sitemap.xml
`;
return new Response(body, { headers: { "Content-Type": "text/plain" } });
}
import { SITE_URL } from "$app/env/public";
export const prerender = true;
export function GET() {
const body = `<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url>
<loc>${SITE_URL}/</loc>
</url>
<url>
<loc>${SITE_URL}/about</loc>
</url>
</urlset>
`;
return new Response(body, { headers: { "Content-Type": "application/xml" } });
}
Changes to existing files
<script lang="ts">+ import { Button } from "#lib/components/ui/button/index.js";+ import {+ Card,+ CardContent,+ CardFooter,+ CardHeader,+ CardTitle,+ } from "#lib/components/ui/card/index.js";+ let count = $state(0); </script> +<Card class="w-64 text-center">+ <CardHeader>+ <CardTitle>Counter</CardTitle>+ </CardHeader>+ <CardContent>+ <p class="text-5xl font-bold tabular-nums">{count}</p>+ </CardContent>+ <CardFooter class="justify-center gap-3">+ <Button variant="outline" onclick={() => count--}>-1</Button>+ <Button onclick={() => count++}>+1</Button>+ </CardFooter>+</Card>−<div class="card">− <p class="count">{count}</p>− <div class="row">− <button type="button" class="btn" onclick={() => count--}>-1</button>− <button type="button" class="btn" onclick={() => count++}>+1</button>− </div>−</div>
<script lang="ts">+ import { SITE_URL } from "$app/env/public"; import { resolve } from "$app/paths";+ import { page } from "$app/state"; import type { LayoutProps } from "./$types"; import "./layout.css"; let { children }: LayoutProps = $props();+ + const jsonLd = JSON.stringify({+ "@context": "https://schema.org",+ "@type": "WebSite",+ name: "my-app",+ url: SITE_URL,+ });+ // The closing tag is split so it neither ends this block nor trips svelte-eslint-parser.+ const jsonLdScript = `<script type="application/ld+json">${jsonLd}</${"script"}>`; </script> +<svelte:head>+ <meta name="description" content="my-app: a web app." />+ <link rel="canonical" href={SITE_URL + page.url.pathname} />+ <meta property="og:type" content="website" />+ <meta property="og:site_name" content="my-app" />+ <meta property="og:url" content={SITE_URL + page.url.pathname} />+ <meta name="twitter:card" content="summary" />+ <!-- eslint-disable-next-line svelte/no-at-html-tags -->+ {@html jsonLdScript}+</svelte:head>+ +<main+ class="flex min-h-screen flex-col items-center justify-center gap-8 bg-slate-50 p-8 text-slate-900"+>+ <nav class="flex gap-4 text-sm font-medium">+ <a class="text-slate-600 hover:text-slate-900" href={resolve("/")}>Home</a>+ <a class="text-slate-600 hover:text-slate-900" href={resolve("/about")}>+ About+ </a>−<main class="app">− <nav class="nav">− <a class="link" href={resolve("/")}>Home</a>− <a class="link" href={resolve("/about")}>About</a> </nav> {@render children()} </main>⋯ 1 unchanged lines
⋯ 1 unchanged lines import Counter from "#lib/Counter.svelte"; </script> +<svelte:head>+ <title>Home | my-app</title>+</svelte:head>+ +<section class="flex flex-col items-center gap-6">+ <h1 class="text-3xl font-bold tracking-tight">my-app</h1>−<section class="page">− <h1 class="title">my-app</h1> <Counter /> </section>
+<svelte:head>+ <title>About | my-app</title>+</svelte:head>+ +<section class="flex flex-col items-center gap-6">+ <h1 class="text-3xl font-bold tracking-tight">About</h1>+ <p class="max-w-md text-center text-slate-600">+ Built with SvelteKit, Svelte 5, TypeScript, Tailwind CSS, shadcn-svelte,+ Vitest, ESLint, Prettier, SEO.+ </p>−<section class="page">− <h1 class="title">About</h1>− <p class="text">Built with SvelteKit, Svelte 5, TypeScript.</p> </section>
+@import "tailwindcss";+@import "tw-animate-css";+@import "shadcn-svelte/tailwind.css";+@import "@fontsource-variable/inter";−:root {− font-family: system-ui, sans-serif;− color: #0f172a;− background: #f8fafc;−} +@custom-variant dark (&:is(.dark *));−body {− margin: 0;−} +:root {+ --background: oklch(1 0 0);+ --foreground: oklch(0.145 0 0);+ --card: oklch(1 0 0);+ --card-foreground: oklch(0.145 0 0);+ --popover: oklch(1 0 0);+ --popover-foreground: oklch(0.145 0 0);+ --primary: oklch(0.205 0 0);+ --primary-foreground: oklch(0.985 0 0);+ --secondary: oklch(0.97 0 0);+ --secondary-foreground: oklch(0.205 0 0);+ --muted: oklch(0.97 0 0);+ --muted-foreground: oklch(0.556 0 0);+ --accent: oklch(0.97 0 0);+ --accent-foreground: oklch(0.205 0 0);+ --destructive: oklch(0.577 0.245 27.325);+ --border: oklch(0.922 0 0);+ --input: oklch(0.922 0 0);+ --ring: oklch(0.708 0 0);+ --chart-1: oklch(0.87 0 0);+ --chart-2: oklch(0.556 0 0);+ --chart-3: oklch(0.439 0 0);+ --chart-4: oklch(0.371 0 0);+ --chart-5: oklch(0.269 0 0);+ --radius: 0.625rem;+ --sidebar: oklch(0.985 0 0);+ --sidebar-foreground: oklch(0.145 0 0);+ --sidebar-primary: oklch(0.205 0 0);+ --sidebar-primary-foreground: oklch(0.985 0 0);+ --sidebar-accent: oklch(0.97 0 0);+ --sidebar-accent-foreground: oklch(0.205 0 0);+ --sidebar-border: oklch(0.922 0 0);+ --sidebar-ring: oklch(0.708 0 0);−.app {− min-height: 100vh;− display: flex;− flex-direction: column;− align-items: center;− justify-content: center;− gap: 2rem;− padding: 2rem;− box-sizing: border-box; } +.dark {+ --background: oklch(0.145 0 0);+ --foreground: oklch(0.985 0 0);+ --card: oklch(0.205 0 0);+ --card-foreground: oklch(0.985 0 0);+ --popover: oklch(0.205 0 0);+ --popover-foreground: oklch(0.985 0 0);+ --primary: oklch(0.922 0 0);+ --primary-foreground: oklch(0.205 0 0);+ --secondary: oklch(0.269 0 0);+ --secondary-foreground: oklch(0.985 0 0);+ --muted: oklch(0.269 0 0);+ --muted-foreground: oklch(0.708 0 0);+ --accent: oklch(0.269 0 0);+ --accent-foreground: oklch(0.985 0 0);+ --destructive: oklch(0.704 0.191 22.216);+ --border: oklch(1 0 0 / 10%);+ --input: oklch(1 0 0 / 15%);+ --ring: oklch(0.556 0 0);+ --chart-1: oklch(0.87 0 0);+ --chart-2: oklch(0.556 0 0);+ --chart-3: oklch(0.439 0 0);+ --chart-4: oklch(0.371 0 0);+ --chart-5: oklch(0.269 0 0);+ --sidebar: oklch(0.205 0 0);+ --sidebar-foreground: oklch(0.985 0 0);+ --sidebar-primary: oklch(0.488 0.243 264.376);+ --sidebar-primary-foreground: oklch(0.985 0 0);+ --sidebar-accent: oklch(0.269 0 0);+ --sidebar-accent-foreground: oklch(0.985 0 0);+ --sidebar-border: oklch(1 0 0 / 10%);+ --sidebar-ring: oklch(0.556 0 0);−.title {− font-size: 1.875rem;− margin: 0; } +@theme inline {+ --font-sans: "Inter Variable", sans-serif;+ --color-sidebar-ring: var(--sidebar-ring);+ --color-sidebar-border: var(--sidebar-border);+ --color-sidebar-accent-foreground: var(--sidebar-accent-foreground);+ --color-sidebar-accent: var(--sidebar-accent);+ --color-sidebar-primary-foreground: var(--sidebar-primary-foreground);+ --color-sidebar-primary: var(--sidebar-primary);+ --color-sidebar-foreground: var(--sidebar-foreground);+ --color-sidebar: var(--sidebar);+ --color-chart-5: var(--chart-5);+ --color-chart-4: var(--chart-4);+ --color-chart-3: var(--chart-3);+ --color-chart-2: var(--chart-2);+ --color-chart-1: var(--chart-1);+ --color-ring: var(--ring);+ --color-input: var(--input);+ --color-border: var(--border);+ --color-destructive: var(--destructive);+ --color-accent-foreground: var(--accent-foreground);+ --color-accent: var(--accent);+ --color-muted-foreground: var(--muted-foreground);+ --color-muted: var(--muted);+ --color-secondary-foreground: var(--secondary-foreground);+ --color-secondary: var(--secondary);+ --color-primary-foreground: var(--primary-foreground);+ --color-primary: var(--primary);+ --color-popover-foreground: var(--popover-foreground);+ --color-popover: var(--popover);+ --color-card-foreground: var(--card-foreground);+ --color-card: var(--card);+ --color-foreground: var(--foreground);+ --color-background: var(--background);+ --radius-sm: calc(var(--radius) * 0.6);+ --radius-md: calc(var(--radius) * 0.8);+ --radius-lg: var(--radius);+ --radius-xl: calc(var(--radius) * 1.4);+ --radius-2xl: calc(var(--radius) * 1.8);+ --radius-3xl: calc(var(--radius) * 2.2);+ --radius-4xl: calc(var(--radius) * 2.6);−.nav {− display: flex;− gap: 1rem; } +@layer base {+ * {+ @apply border-border outline-ring/50;+ }+ body {+ @apply bg-background text-foreground;+ }+ html {+ @apply font-sans;+ }−.link {− color: #475569;− text-decoration: none;− font-weight: 500; } −.link:hover {− color: #0f172a;−}− −.page {− display: flex;− flex-direction: column;− align-items: center;− gap: 1.5rem;−}− −.text {− max-width: 28rem;− text-align: center;− color: #475569;−}− −.card {− background: #fff;− padding: 2rem;− border-radius: 1rem;− box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08);− text-align: center;−}− −.count {− font-size: 3rem;− font-weight: 700;− margin: 0;− font-variant-numeric: tabular-nums;−}− −.row {− margin-top: 1.5rem;− display: flex;− justify-content: center;− gap: 0.75rem;−}− −.btn {− background: #0f172a;− color: #fff;− border: 0;− border-radius: 0.5rem;− padding: 0.5rem 1rem;− font: inherit;− cursor: pointer;−}− −.btn:hover {− background: #334155;−}−
import adapter from "@sveltejs/adapter-static"; import { sveltekit } from "@sveltejs/kit/vite";+import tailwindcss from "@tailwindcss/vite";+import { defineConfig } from "vitest/config";−import { defineConfig } from "vite"; export default defineConfig({ plugins: [+ tailwindcss(), sveltekit({ compilerOptions: { // Force runes mode for the project, except for libraries. Can be removed in svelte 6.⋯ 3 unchanged lines adapter: adapter(), }), ],+ test: {+ expect: { requireAssertions: true },+ projects: [+ {+ extends: "./vite.config.ts",+ resolve: { conditions: ["browser"] },+ test: {+ name: "client",+ environment: "jsdom",+ include: ["src/**/*.svelte.{test,spec}.{js,ts}"],+ },+ },+ {+ extends: "./vite.config.ts",+ test: {+ name: "server",+ environment: "node",+ include: ["src/**/*.{test,spec}.{js,ts}"],+ exclude: ["src/**/*.svelte.{test,spec}.{js,ts}"],+ },+ },+ ],+ }, });
Project files
.gitignore.prettierignore.prettierrcREADME.mdcomponents.jsoneslint.config.jspackage.jsonsrc/app.d.tssrc/app.htmlsrc/env.tssrc/lib/Counter.sveltesrc/lib/Counter.svelte.test.tssrc/lib/components/ui/button/button.sveltesrc/lib/components/ui/button/index.tssrc/lib/components/ui/card/card-action.sveltesrc/lib/components/ui/card/card-content.sveltesrc/lib/components/ui/card/card-description.sveltesrc/lib/components/ui/card/card-footer.sveltesrc/lib/components/ui/card/card-header.sveltesrc/lib/components/ui/card/card-title.sveltesrc/lib/components/ui/card/card.sveltesrc/lib/components/ui/card/index.tssrc/lib/index.tssrc/lib/utils.tssrc/routes/+layout.sveltesrc/routes/+layout.tssrc/routes/+page.sveltesrc/routes/about/+page.sveltesrc/routes/layout.csssrc/routes/robots.txt/+server.tssrc/routes/sitemap.xml/+server.tstsconfig.jsonvite.config.ts