Skip to content

Commit

Permalink
fix(module): use variants key for safelist
Browse files Browse the repository at this point in the history
  • Loading branch information
benjamincanac committed Feb 14, 2022
1 parent c636ff2 commit 4c89122
Showing 1 changed file with 15 additions and 7 deletions.
22 changes: 15 additions & 7 deletions src/module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,13 +90,21 @@ export default defineNuxtModule<ModuleOptions>({
resolve(runtimeDir, 'presets/*.{mjs,js,ts}')
],
// Safelist dynamic colors used in preset
safelist: [{
pattern: new RegExp(`(hover|disabled|dark:)?bg-(${safeColorsAsRegex})-(100|600|700)`)
}, {
pattern: new RegExp(`(dark:)?text-(${safeColorsAsRegex})-(100|800)`)
}, {
pattern: new RegExp(`(focus:)?ring-(${safeColorsAsRegex})-(500)`)
}]
safelist: [
'dark',
{
pattern: new RegExp(`bg-(${safeColorsAsRegex})-(100|600|700)`),
variants: ['hover', 'disabled', 'dark']
},
{
pattern: new RegExp(`text-(${safeColorsAsRegex})-(100|800)`),
variants: ['dark']
},
{
pattern: new RegExp(`ring-(${safeColorsAsRegex})-(500)`),
variants: ['focus']
}
]
},
cssPath: resolve(runtimeDir, 'tailwind.css')
})
Expand Down

1 comment on commit 4c89122

@vercel
Copy link

@vercel vercel bot commented on 4c89122 Feb 14, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

Please sign in to comment.