Skip to content

2.0.1 purge problem(?) #2793

Answered by simonswiss
sezeregrek asked this question in Help
Nov 18, 2020 · 6 comments · 5 replies
Discussion options

You must be logged in to vote

Hey!

I just had a look at @shivamsn97's repo.

When you are using the darkMode: 'class' strategy, the generated CSS for the dark mode variants will be:

.dark .dark\:text-gray-200

PurgeCSS is looking for the actual dark class name in order to keep these classes in the CSS output. If it doesn't (even if it finds dark:text-gray-200), it will throw them away.

You can verify that by adding class="dark" to the <body> tag in your HTML page, and run the build command again. Dark mode classes will now be preserved.

Another approach is to ass dark in your safelist for the purge options:

purge: {
  enabled: true,
  preserveHtmlElements: false,
  content: ["**/*.html", "**/*.js"],
+  options: {
+    s…

Replies: 6 comments 5 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
3 replies
@shivamsn97
Comment options

@simonswiss
Comment options

@simonswiss
Comment options

Comment options

You must be logged in to vote
2 replies
@zbecknell
Comment options

@simonswiss
Comment options

Answer selected by simonswiss
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
5 participants