Home > Enterprise >  create-react-app w/ TypeScript & Tailwind CSS; Tailwind's utility classes are not being applied
create-react-app w/ TypeScript & Tailwind CSS; Tailwind's utility classes are not being applied

Time:07-12

I've been searching all over to try and resolve this issue. I created a React app with TypeScript and installed Tailwind CSS using the React setup shown on the Tailwind site My output

CodePudding user response:

Try to remove the spaces between the file endings in your tailwind.config.js:

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

If that doesn't correct your problem, try to remove the CSS import in your App.tsx:

import React from 'react';
import logo from './logo.svg';

function App() {
  return (
    <div className="items-center justify-center">
    <h1 className="text-3xl font-bold underline">
      Testing
    </h1>
    </div>
  );
}

export default App;
  • Related