Files
vf_react/tailwind.config.js
2025-11-22 15:34:18 +08:00

75 lines
1.7 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/** @type {import('tailwindcss').Config} */
const { heroui } = require("@heroui/react");
const path = require("path");
module.exports = {
content: {
relative: true,
files: [
// 只扫描项目源码(不包含 node_modules
"./src/**/*.{js,jsx,ts,tsx}",
"./public/index.html",
// Hero UI 必需的文件(精确路径)
"./node_modules/@heroui/theme/dist/**/*.{js,mjs}",
"./node_modules/@heroui/react/dist/**/*.{js,mjs}",
],
// 明确排除 node_modules 的其他部分
transform: {
// 排除 node_modules 中非 heroui 的文件
DEFAULT: (content, { path: filePath }) => {
// 如果是 node_modules 中的文件,但不是 @heroui则跳过
if (filePath.includes('node_modules') && !filePath.includes('@heroui')) {
return '';
}
return content;
},
},
},
darkMode: "class", // 支持深色模式
theme: {
extend: {
// Brainwave 自定义颜色
colors: {
n: {
1: "#FFFFFF",
2: "#CAC6DD",
3: "#ADA8C3",
4: "#757185",
5: "#3F3A52",
6: "#252134",
7: "#15131D",
8: "#0E0C15",
},
color: {
1: "#AC6AFF",
2: "#FFC876",
3: "#FF776F",
4: "#7ADB78",
5: "#858DFF",
6: "#FF98E2",
},
stroke: {
1: "#26242C",
},
},
},
},
plugins: [heroui()],
// 性能优化
safelist: [
// Hero UI 动态类名
'bg-gradient-to-br',
'from-blue-500',
'to-purple-500',
'backdrop-blur-xl',
],
// 优化缓存
cacheLocation: path.resolve(__dirname, 'node_modules/.cache/tailwindcss'),
}