Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Tailwind class not working in a React project (Bootstrap previously installed)

I am working in a React project where I had to merge another project with a existing one. So I transferred all the components, Assets & installed all the packages. But particularly tailwind css classes are not working in this project. (Note: This project uses bootstrap also)

So the question now is how I can run tailwind in this project?

package.json

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

{
  "name": "my-app",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "@testing-library/jest-dom": "^5.14.1",
    "@testing-library/react": "^11.2.7",
    "@testing-library/user-event": "^12.8.3",
    "aos": "^3.0.0-beta.6",
    "axios": "^0.21.4",
    "cogo-toast": "^4.2.3",
    "django-react-csrftoken": "^1.0.4",
    "jquery": "^3.6.0",
    "react": "^16.8.6",
    "react-animated-css": "^1.2.1",
    "react-animated-text-content": "^1.0.1",
    "react-bootstrap": "^1.6.3",
    "react-confetti": "^6.0.1",
    "react-datepicker": "^4.2.1",
    "react-dom": "^17.0.2",
    "react-fast-marquee": "^1.2.1",
    "react-helmet": "^6.1.0",
    "react-highlight-words": "^0.17.0",
    "react-icons": "^4.2.0",
    "react-image-lightbox": "^5.1.4",
    "react-inner-image-zoom": "^2.1.0",
    "react-modern-calendar-datepicker": "^3.1.6",
    "react-rainbow-components": "^1.27.0",
    "react-router-dom": "^5.3.0",
    "react-script-tag": "^1.1.2",
    "react-scripts": "4.0.3",
    "react-scroll-up": "^1.3.7",
    "react-slick": "^0.28.1",
    "react-toastify": "^8.0.3",
    "reactjs-popup": "^2.0.5",
    "slick-carousel": "^1.8.1",
    "sweetalert2": "^11.3.4",
    "web-vitals": "^1.1.2"
  },
  "scripts": {
    "start": "react-scripts --openssl-legacy-provider start",
    "cleanBuild": "rimraf ./build/*",
    "build": "npm run cleanBuild && set \"GENERATE_SOURCEMAP=false\" && react-scripts --openssl-legacy-provider build ",
    "test": "react-scripts test",
    "eject": "react-scripts eject"
  },
  "eslintConfig": {
    "extends": [
      "react-app",
      "react-app/jest"
    ]
  },
  "browserslist": {
    "production": [
      ">0.2%",
      "not dead",
      "not op_mini all"
    ],
    "development": [
      "last 1 chrome version",
      "last 1 firefox version",
      "last 1 safari version"
    ]
  },
  "devDependencies": {
    "@iconify/react": "^4.1.0",
    "tailwindcss": "^3.3.0"
  }
}

Tailwind config

/** @type {import('tailwindcss').Config} */
module.exports = {
  content: [
    "./src/**/*.{js,jsx,ts,tsx}",
  ],
  theme: {
    extend: {},
  },
  plugins: [],
}

index.css

@tailwind base;
@tailwind components;
@tailwind utilities;

Thanks in advance!

>Solution :

0

I went through most of the suggestions and obviously none were going to work if i had a spelling mistake,

It was a simple s missing , please check your spelling

I hope this helps

also try to do this again install it

step 1 :-

npm install tailwindcss postcss autoprefixer@^9.8.6

step 2 :-

npm install react-scripts@latest

step 3 :-

 npx tailwindcss init -p

step – 4 :-

run your react application
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading