Tailwind and components folder

Don't forget to put all folders with React classes into tailwind.config.js

Profile pictureToni Petrina
Published on 2022-01-311 min read

    I was curious to see that classes in my components had zero effect, especially with dark mode. After digging a bit, it was a misconfiguration issue. Next.js usually has pages in the pages/ folder and components in the components/ folder. When filling tailwind.config.js don't forget to add both folders:

    content: ["./components/**/*.tsx", "./pages/**/*.tsx"],

    Usually all the code is found in src/ folder so this is easily forgotten.

    Change code theme: