Routify and Tailwind CSS
A guide on how to integrate routify and Tailwind css. Note this is a community written guide by GHOST, thaicodingdev and haudraufhaun.
Getting Started
This guide is desinged for the routify starter template, and should only be a few steps to get up and running! To start lets create our project:
mkdir my-routify-app
cd my-routify-app
npx @roxi/routify init Set up Tailwind CSS
Install the npm package:
npm i tailwindcss -DDo following configuration:
- We need a tailwind config file, so create the
tailwind.config.jsfile with following command:
npx tailwindcss init- Configure
contentas following:
module.exports = { content: ["./src/**/*.svelte", "./src/**/*.css", "./index.html"], // more config below here };- Update your
postcss.config.jsto include tailwind
module.exports = { plugins: [ // Keep current plugins and add tailwind below: require("tailwindcss")(), ], };- We need a tailwind config file, so create the
Adding our css
In your global.css file (which can be found here: src/global.css), add your tailwind @ rules:
@tailwind base;
@tailwind components;
@tailwind utilities; You can remove all the default styles from your global css file since you now have tailwind, but it might be good to include a css reset like greset or modern normalize
All done!
You can now run it with npm run dev! If you have any issues join the discord
Writing good documentation that is up-to-date is difficult. If you notice a mistake, help us out.