-
Notifications
You must be signed in to change notification settings - Fork 1.4k
/
tailwind.config.cjs
52 lines (50 loc) · 1.49 KB
/
tailwind.config.cjs
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
// eslint-disable-next-line @typescript-eslint/no-var-requires
const defaultTheme = require('tailwindcss/defaultTheme')
function rem2px(input, fontSize = 16) {
if (input == null) {
return input
}
switch (typeof input) {
case 'object':
if (Array.isArray(input)) {
return input.map((val) => rem2px(val, fontSize))
}
// eslint-disable-next-line no-case-declarations
const ret = {}
for (const key in input) {
ret[key] = rem2px(input[key], fontSize)
}
return ret
case 'string':
return input.replace(/(\d*\.?\d+)rem$/, (_, val) => `${parseFloat(val) * fontSize}px`)
case 'function':
return eval(input.toString().replace(/(\d*\.?\d+)rem/g, (_, val) => `${parseFloat(val) * fontSize}px`))
default:
return input
}
}
/** @type {import('tailwindcss').Config} */
module.exports = {
content: ['./src/**/*.{js,jsx,ts,tsx}'],
theme: {
...rem2px(defaultTheme),
extend: {
keyframes: {
'fade-in': {
'0%': {
opacity: '0'
},
'100%': {
opacity: '1'
}
}
},
animation: {
'fade-in': 'fade-in 0.3s ease-out'
}
}
},
plugins: [
require('@tailwindcss/typography')
]
}