TailwindCSS with Sapper and Svelte
Carlos Saltos
Posted on September 16, 2020
What ?
An initial template with Sapper 0.28.0, Svelte 3.17.3 and Tailwind CSS 1.8.6 updated to September 25th, 2020
Why ?
Because there are a lot of posts and reference working but with old versions. This is only another alternative more, trying to use newer versions (that soon will be old too).
How ?
Run the commands:
npx degit csaltos/sapper-svelte-with-tailwindcss app1
cd app1
npm i
npm run dev
And open the browser at http://localhost:3000 to see a Sapper page done with Svelte using a Tailwind CSS sample.
Where ?
At https://github.com/csaltos/sapper-svelte-with-tailwindcss you will find the source code as a reference which is based on the original Sapper with Svelte template.
Please take special attention to the commit at dc251b6 which contains the exact change details to activate Tailwind CSS.
Who ?
This template is possible thanks to many posts and reference from:
- https://github.com/dan-unhuman/sapper-template-rollup-tailwind (special thanks to dan for this cool solution used on this version 2)
- https://www.apostrof.co/blog/getting-tailwind-css-to-integrate-nicely-with-svelte-sapper/
- https://github.com/tailwindlabs/tailwindcss-setup-examples/tree/master/examples/sapper
- https://github.com/babichjacob/sapper-postcss-template
- https://github.com/sarioglu/sapper-tailwindcss-template
- https://dev.to/sarioglu/using-svelte-with-tailwindcss-a-better-approach-47ph
- https://dev.to/alancwoo/sapper-svelte-postcss-tailwind-473i
- https://github.com/sveltejs/language-tools/blob/master/docs/preprocessors/other-css-preprocessors.md
- https://dev.to/inalbant/a-simpler-way-to-add-tailwindcss-to-your-svelte-project-11ja
IMPORTANT: obviously this is only a starting point, please review TailwindCSS documentation for further steps.
NOTE: you may also use Smelte which comes already configured with TailwindCSS and cool Material components with Sapper and Svelte here -> https://smeltejs.com/
Posted on September 16, 2020
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.