Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

All dark mode classes are purged #3061

Closed
mattiaz9 opened this issue Dec 10, 2020 · 2 comments
Closed

All dark mode classes are purged #3061

mattiaz9 opened this issue Dec 10, 2020 · 2 comments
Assignees

Comments

@mattiaz9
Copy link

Describe the problem:

When I build the production style all the dark mode classes are removed. This happens with the utility classes, for instance dark:text-gray-500, but not when you create custom components with @apply.

I tried searching for any class that begins with dark: in the compiled stylesheet, but I couldn't find any.

My purge config is the following:

purge: {
  content: [
    "./public/**/*.html",
    "./src/app/**/*.js",
    "./src/components/**/*.js",
    "./src/pages/**/*.js",
  ],
}

I'm using

  • tailwindcss 2.0.1
  • react-scripts 4.0.1
  • @craco/craco 6.0.0
@RobinMalfait
Copy link
Contributor

Hey! Thank you for your bug report!
Much appreciated! 🙏

Can you create a reproduction repository that you can share with us?
Also verify that if you are using darkMode: "class" that your code to toggle the "dark" class is also in one of the files listed in the purge list.

Example: https://tailwindcss.com/docs/dark-mode#toggling-dark-mode-manually

@mattiaz9
Copy link
Author

I couldn't really reproduce the issue, but I managed to fix it by being less specific in the purge config.
In particular instead of specifying all the folders in src containing react components, I specified the entire folder like so:

purge: {
  content: [
    "./public/**/*.html",
    "./src/**/*.js",
  ],
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants