Add Tailwind to Ionic-React App
https://tailwindcss.com/docs/guides/create-react-app
Install Tailwind CSS
Install tailwindcss via npm, and then run the init command to generate your tailwind.config.js file.
npm install -D tailwindcss
npx tailwindcss init
Configure your template paths
Add the paths to all of your template files in your
tailwind.config.jsfile./** @type {import('tailwindcss').Config} */
module.exports = {
content: [
"./src/**/*.{js,jsx,ts,tsx}",
],
theme: {
extend: {},
},
plugins: [],
}
Add the Tailwind directives to your CSS
Add the @tailwind directives for each of Tailwind’s layers to your src/theme/variables.css file
@tailwind base;
@tailwind components;
@tailwind utilities;
Start your build process
Run your build process with npm run start.
Start using Tailwind in your project
Start using Tailwind’s utility classes to style your content.
export default function App() {
return (
<h1 className="text-3xl font-bold underline">
Hello world!
</h1>
)
}
Comments
Post a Comment