Requirements
Installation
WARNING: The following guide will install a pre-release version of Skeleton v3. Be aware that some features may be missing, incomplete, or non-functional at this time. Please report bugs and issues on GitHub or Discord.
Create a Project
Start by creating a new Vite project. The template flags will install Svelte and Typescript.
npm create vite@latest my-skeleton-app -- --template svelte-tscd my-skeleton-appnpm install
Install Skeleton
Install the Skeleton core and Svelte component packages.
npm i -D @skeletonlabs/skeleton@next @skeletonlabs/skeleton-svelte@next
Install Tailwind
Install Tailwind and its dependencies.
npm install -D tailwindcss postcss autoprefixernpx tailwindcss init -p
Configure Tailwind
Locate tailwind.config
in the root of your project and make the following changes:
import { skeleton, contentPath } from "@skeletonlabs/skeleton/plugin";import * as themes from "@skeletonlabs/skeleton/themes";
/** @type {import('tailwindcss').Config} */export default { content: [ "./index.html", "./src/**/*.{js,ts,svelte}", contentPath(import.meta.url, "svelte"), ], theme: { extend: {}, }, plugins: [ skeleton({ // NOTE: each theme included will increase the size of your CSS bundle themes: [themes.cerberus, themes.rose], }), ],};
Add Tailwind Directives
Open /src/app.css
and add the following Tailwind directives:
@tailwind base;@tailwind components;@tailwind utilities;
We also recommend removing all existing CSS styles in /src/app.css
and /src/App.svelte
.
Set the Active Theme
Open index.html
, then set the data-theme
attribute on the body tag to define the active theme.
<body data-theme="cerberus">...</body>
Done
Start the dev server using the following command.
npm run dev