skip to Main Content

trying to use tailwindcss with react

I installed tailwind already but yet cant see its effect in my react code.

Used tailwind documentations yet no changes

created a tailwind.config.js file, did this as well

                 @tailwind base;

@tailwind components;
@tailwind utilities;

2

Answers


  1. First step:

    npm install -D tailwindcss
    

    Second step:

    npx tailwindcss init
    

    Third step, paste this in content in tailwind.config.js file:

    "./src/**/*.{js,jsx,ts,tsx}"
    

    Fourth step, paste these in your CSS file, then import CSS to your JS or JSX file:

    @tailwind base;
    @tailwind components;
    @tailwind utilities;
    
    Login or Signup to reply.
  2. Follow the tailwind docs carefully, and do all the steps below:

    1. Install Tailwind CSS
    npm install -D tailwindcss
    npx tailwindcss init
    
    1. Create tailwind.config.js file
    /** @type {import('tailwindcss').Config} */
    module.exports = {
      content: ["./src/**/*.{html,js}"],
      theme: {
        extend: {},
      },
      plugins: [],
    }
    
    1. Add the Tailwind directives to your CSS
    @tailwind base;
    @tailwind components;
    @tailwind utilities;
    
    1. Start the Tailwind CLI build process
    npx tailwindcss -i ./src/input.css -o ./dist/output.css --watch
    

    After do all of this, you can use Tailwind’s utility classes in your project

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search