Here's a step-by-step guide on how to install Tailwind CSS v4 in your Ionic project:
First, you need to install Tailwind CSS to use it within your Ionic project.Open your terminal and run the following command:
Next, you'll need to configure Vite to use the Tailwind. Open your vite.config.ts file and add the following configuration:
vite.config.ts.png 670.47 KBThis will enable Tailwind CSS to work with Vite in your Ionic project.
Now, create or update your theme/variables.css to include the Tailwind CSS styles. This will allow you to customize and use Tailwind’s utility classes throughout your Ionic app.In your variables.css, add the following:
theme_variables.css.png 363.41 KBYou have to disable preflight to avoid breaking Ionic styles.
That's it! You’ve successfully integrated Tailwind CSS v4 with your Ionic project. Now, you can use Tailwind’s utility classes throughout your app while retaining Ionic's unique styles!