Search code examples
sveltetailwind-csssvelte-3sveltekit

Use Sveltekit and Tailwind CSS


Sveltekit is finally in public beta. Does anyone know how to use it with Tailwind CSS? There aren't any official docs for this integration.


Solution

  • Since you're using SvelteKit, you can also look at using the Svelte Adder for Tailwind.

    From their README:

    You must start with a fresh copy of the official SvelteKit template, which is currently created by running this command:

    npm init svelte@next

    Once that is set up, run this command in your project directory to set up Tailwind CSS:

    npx svelte-add tailwindcss # --jit

    That command will perform the Tailwind setup for you, so you don't have to create all the configs yourself.