pnpm create vite
;
Choose react + Typescript + SWC template project.
-
install dependencies with
pnpm add -D tailwindcss postcss autoprefixer
; -
Generate both tailwind.config.cjs and postcss.config.cjs with
pnpm exec tailwindcss init -p
; -
Configure your template paths in tailwind.config.cjs file:
/** @type {import('tailwindcss').Config} */
module.exports = {
content: [
"./index.html",
"./src/**/*.{js,ts,jsx,tsx}",
],
theme: {
extend: {},
},
plugins: [],
}
To add customized colors to tailwindcss pallete, use extend option above. Follow the example:
...
theme: {
extend: {
colors: {
backgroung: '#09090A',
},
},
},
...
-
Add the Tailwind directives to your CSS global file @tailwind base; @tailwind components; @tailwind utilities;
-
Done! Start using Tailwind in your project.
-
Install dependencies with
pnpm add -D eslint @rocketseat/eslint-config
; -
Create a file called .eslintrc.json at root dir and put this on it:
{
"extends": "@rocketseat/eslint-config/react"
}
- Add the following script in package.json:
"scripts": {
...
"lint": "eslint src --ext .ts,.tsx"
},
...
To check ESLint problems run
pnpm lint
, and add --fix to fix them.