diff --git a/src/styles/brainwave.css b/src/styles/brainwave.css index 227c948a..4954e350 100644 --- a/src/styles/brainwave.css +++ b/src/styles/brainwave.css @@ -2,6 +2,10 @@ @tailwind components; @tailwind utilities; +/* Hero UI 源码扫描(Tailwind v4 推荐方式) */ +@source "../node_modules/@heroui/theme"; +@source "../node_modules/@heroui/react"; + body { } diff --git a/tailwind.config.js b/tailwind.config.js index 2a615f7f..78e867d1 100644 --- a/tailwind.config.js +++ b/tailwind.config.js @@ -2,11 +2,11 @@ const { heroui } = require("@heroui/react"); module.exports = { - // 最小化扫描范围 - 只包含绝对必要的文件 + // 只扫描项目源码,不包含 node_modules + // Hero UI 通过 @source 指令在 brainwave.css 中声明 content: [ - "./src/views/AgentChat/**/*.{js,jsx}", // 只扫描 AgentChat(使用 Hero UI 的页面) - "./src/index.js", // 入口文件 - "./public/index.html", // HTML 模板 + "./src/**/*.{js,jsx}", + "./public/index.html", ], darkMode: "class", @@ -42,22 +42,10 @@ module.exports = { plugins: [heroui()], - // 预加载所有可能用到的 Hero UI 类名 safelist: [ - // 布局 - 'flex', 'flex-1', 'flex-col', 'grid', 'overflow-hidden', - // 渐变 - 'bg-gradient-to-br', 'from-blue-500', 'to-purple-500', - 'from-gray-900', 'to-gray-800', 'via-slate-900', - // 毛玻璃 - 'backdrop-blur-xl', 'bg-white/80', 'bg-gray-900/95', 'bg-gray-800/80', - // 边框 - 'border-gray-200', 'border-gray-700', 'border-gray-800', - // 文字颜色 - 'text-gray-100', 'text-gray-300', 'text-gray-400', - // 背景颜色 - 'bg-gray-800', 'bg-gray-900', 'bg-blue-500', - // 悬停状态 - 'hover:bg-gray-700', 'hover:border-blue-500', + 'bg-gradient-to-br', + 'from-blue-500', + 'to-purple-500', + 'backdrop-blur-xl', ], }