Configuring Tailwind CSS

👋 Hi, this is how you can add tailwind css to your create-react-app

npm install --save tailwindcss postcss-cli autoprefixer concurrently

Then go to your package.json file and add this

  "scripts": {
    "tailwind": "postcss src/tailwind.css -o public/App.css",
    "start": "concurrently \"npm run tailwind" \"react-scripts start""

Then go to your src/ directory and create a file called tailwind.css and add this

@tailwind base;

@tailwind components;

@tailwind utilities;

This will automatically inject the baseline css into your App.css file

Then run

npm run start

You should see the basic tailwind css classes and normalization of css in App.css file

You should be good to go.

Pranay Aryal

Pranay Aryal

Software Developer

Read More