Skip to content

Commit

Permalink
safelist data-theme
Browse files Browse the repository at this point in the history
  • Loading branch information
AdrianGonz97 committed Aug 18, 2023
1 parent 2b560d3 commit ef556dd
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/khaki-ties-sip.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'vite-plugin-tailwind-purgecss': patch
---

fix: Added `data-theme` to the safelist
3 changes: 1 addition & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ export function purgeCss(purgeOptions?: PurgeOptions): Plugin {
'html',
'body',
/aria-current/,
/svelte-/,
// fix for pseudo-class functions that begin with `:` getting purged (e.g. `:is`)
// see: https://github.com/FullHuman/purgecss/issues/978
/^\:[-a-z]+$/,
Expand Down Expand Up @@ -102,7 +101,7 @@ export function purgeCss(purgeOptions?: PurgeOptions): Plugin {
safelist: {
...purgeOptions?.safelist,
standard,
greedy: [/svelte-/, ...(purgeOptions?.safelist?.greedy ?? [])],
greedy: [/svelte-/, /data-theme/, ...(purgeOptions?.safelist?.greedy ?? [])],
},
});

Expand Down

0 comments on commit ef556dd

Please sign in to comment.