From c21ea532cb4d76c64d9cb7b9d4446bbfdf3d03a9 Mon Sep 17 00:00:00 2001 From: winches <329487092@qq.com> Date: Mon, 11 Nov 2024 17:17:43 +0800 Subject: [PATCH] fix: darkMode tailwindcss config check --- src/helpers/check.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/helpers/check.ts b/src/helpers/check.ts index 3e227b5..e890aee 100644 --- a/src/helpers/check.ts +++ b/src/helpers/check.ts @@ -244,7 +244,10 @@ export function checkTailwind( if (type === 'all') { // Check if the required content is added Detail: https://nextui.org/docs/guide/installation#global-installation const darkMatch = getMatchArray('darkMode', tailwindContent); - const isDarkModeCorrect = darkMatch.some((darkMode) => darkMode.includes('class')); + // Some tailwind.config.js use darkMode: 'class' not darkMode: ['class'] + const isDarkModeCorrect = + darkMatch.some((darkMode) => darkMode.includes('class')) || + /darkMode:\s*["'`]class/.test(tailwindContent); const isContentCorrect = contentMatch.some((content) => content.includes(tailwindRequired.content) );