Add Tailwind
Use the sv
CLI to add Tailwind CSS to your project.
Add dependencies
Add the following dependencies to your project:
Add icon library
Install lucide-svelte
:
If you are using SvelteKit and are not using the default alias $lib
, you'll need to update your svelte.config.js
file to include those aliases.
If you are not using SvelteKit, then you'll need to update your path aliases in your tsconfig.json
and vite.config.ts
.
This is what this project's tailwind.config.js
file looks like:
Feel free to add or modify as needed to suit your project.
Add the following to your src/app.pcss
file. You can learn more about using CSS variables for theming in the theming section.
You'll want to create a cn
helper to make it easier to conditionally add and merge Tailwind CSS classes.
Import styles to your app
Create src/routes/+layout.svelte
and import the styles:
That's it
You can now start adding components to your project.