-
Notifications
You must be signed in to change notification settings - Fork 61
/
tailwind.config.mjs
136 lines (132 loc) · 3.1 KB
/
tailwind.config.mjs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
const defaultTheme = require('tailwindcss/defaultTheme');
import { goatuiPlugins, getSafelist } from "@serverless-cd/goat-ui/src/plugins"
import { GOAT_UI_CONTENT_PATH } from "@serverless-cd/goat-ui/src/common";
import { UI } from './src/utils/config.ts';
import plugin from "tailwindcss/plugin"
const colorList = UI?.colors;
// 预先设置tailwindcss的safelist,保证动态classname
const safelist = getSafelist({
colorList: Object.keys(colorList)
});
/** @type {import('tailwindcss').Config} */
export default {
content: [
"./src/**/*.{astro,html,js,jsx,md,mdx,svelte,ts,tsx,vue}",
GOAT_UI_CONTENT_PATH,
],
safelist: safelist,
plugins: [
...goatuiPlugins,
plugin(function({ addUtilities }) {
const newUtilities = {
// 卡片hover动效
'.hover-transform-box-shadow': {
transition: 'transform 0.2s, box-shadow 0.2s',
'&:hover': {
transform: 'translateY(-4px)',
boxShadow: '4px 4px 8px rgba(0, 0, 0, 0.1), -4px -4px 8px rgba(0, 0, 0, 0.1)',
},
},
}
addUtilities(newUtilities, ['responsive', 'hover']);
}),
],
theme: {
colors: colorList,
extend: {
fontFamily: {
sans: ["Roboto", "SourceHanSans", "sans-serif"],
mono: ["Roboto", "SourceHanSans", "sans-serif"],
},
keyframes: {
fadeByGroup: {
'0%, 35%, 100%': { opacity: 0 },
'5%, 30%': { opacity: 1 }
}
},
animation: {
'fade-by-group': 'fadeByGroup 9s infinite linear'
},
flex: {
'16': '0 0 16.66%',
},
maxWidth: {
'1/6': '16.66%'
},
typography: (theme) => ({
blogToc: {
css: {
a: {
textDecoration: 'inherit',
color: theme('colors.info'),
fontSize: '0.8275rem',
'&:hover': {
color: theme('colors.neutral'),
}
},
ul: {
listStyleType: 'none', /* 去除默认的列表样式 */
paddingLeft: 0,
li: {
borderInlineStart: `1px solid ${theme('colors.error')}`,
paddingLeft: '0.5rem'
}
},
li: {
paddingLeft: 0,
},
}
},
blogTocfold: {
css: {
a: {
textDecoration: 'inherit',
color: theme('colors.success'),
fontSize: '0.8275rem',
'&:hover': {
color: theme('colors.neutral'),
}
},
ul: {
listStyleType: 'none', /* 去除默认的列表样式 */
paddingLeft: 0,
li: {
paddingLeft: '0.5rem',
paddingBottom: '0.5rem'
}
},
li: {
paddingLeft: 0,
},
}
},
DEFAULT: {
css: {
tbody: {
tr: {
borderTop: '1px solid #eee',
'&:nth-child(odd)': {
backgroundColor: theme('colors.secondary')
},
'&:nth-child(even)': {
backgroundColor: '#fff',
},
}
}
}
}
}),
}
},
daisyui: {
themes: [
{
// you can config light or dark theme color value with an object or as a string, when you set the theme as a string, it means you are using our default theme config.
// all theme color value can only be a string except 'accent' and 'gray'.
light: {
...colorList
},
},
],
},
};