-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtailwind.config.js
154 lines (147 loc) · 3.61 KB
/
tailwind.config.js
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
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
const plugin = require('tailwindcss/plugin')
const typography = {
fontSizeMin: 1.125,
fontSizeMax: 1.25,
msFactorMin: 1.125,
msFactorMax: 1.2,
lineHeight: 1.6,
}
const screensRem = {
min: 20,
'2xs': 30,
xs: 36,
sm: 40,
md: 48,
lg: 64,
xl: 80,
'2xl': 85.364,
}
const fsMin = typography.fontSizeMin
const fsMax = typography.fontSizeMax
const msFactorMin = typography.msFactorMin
const msFactorMax = typography.msFactorMax
const screenMin = screensRem.min
const screenMax = screensRem['2xl']
// Calc min and max font-size
const calcMulti = (multiMin = 0, multiMax = null) => {
return {
fsMin: fsMin * Math.pow(msFactorMin, multiMin),
fsMax: fsMax * Math.pow(msFactorMax, multiMax || multiMin),
}
}
// build the clamp property
const clamp = (multiMin = 0, multiMax = null) => {
const _calcMulti = calcMulti(multiMin, multiMax || multiMin)
const _fsMin = _calcMulti.fsMin
const _fsMax = _calcMulti.fsMax
return `clamp(${_fsMin}rem, calc(${_fsMin}rem + (${_fsMax} - ${_fsMin}) * ((100vw - ${screenMin}rem) / (${screenMax} - ${screenMin}))), ${_fsMax}rem)`
}
const remToPx = (rem) => {
return `${rem * 16}px`
}
module.exports = {
content: ['./index.html', './src/**/*.{vue,js,ts,jsx,tsx}'],
theme: {
screens: {
min: remToPx(screensRem.min),
'2xs': remToPx(screensRem['2xs']),
xs: remToPx(screensRem.xs),
sm: remToPx(screensRem.sm),
md: remToPx(screensRem.md),
lg: remToPx(screensRem.lg),
xl: remToPx(screensRem.xl),
'2xl': remToPx(screensRem['2xl']),
},
fontSize: {
'3xs': clamp(-5),
'2xs': clamp(-2),
xs: clamp(-1),
sm: clamp(-0.5),
base: clamp(0),
ex: clamp(0.125),
md: clamp(0.5),
lg: clamp(1),
xl: clamp(2),
'2xl': clamp(3),
'3xl': clamp(4),
'4xl': clamp(5),
'5xl': clamp(6),
'6xl': clamp(7),
'7xl': clamp(8),
'8xl': clamp(9),
'9xl': clamp(10),
},
fontVariationWidth: {
125: 125,
200: 200,
250: 250,
300: 300,
},
extend: {
aspectRatio: {
banner: '3 / 1',
'game-thumbnail': '5 / 4',
},
keyframes: {
appear: {
from: {
opacity: 0,
transform: 'translateY(5px)',
},
to: {
opacity: 1,
transform: 'translateY(0)',
},
},
},
animation: {
'card-rotation': 'card-rotation 2000ms linear infinite',
appear: 'appear 300ms ease-in forwards',
},
height: {
'fit-content': 'fit-content',
},
width: ({ theme }) => ({
...theme('screens'),
'max-content': 'max-content',
'fit-content': 'fit-content',
'min-content': 'min-content',
}),
maxWidth: ({ theme }) => ({
...theme('width'),
...theme('screens'),
unset: 'unset',
}),
minWidth: ({ theme }) => ({
...theme('width'),
...theme('screens'),
unset: 'unset',
}),
opacity: {
2.5: '0.025',
3.5: '0.035',
7.5: '0.075',
15: '0.15',
},
spacing: {
'1ex': '1ex',
},
},
},
variants: {
extend: {},
},
plugins: [
plugin(({ addUtilities, theme, e }) => {
const values = theme('fontVariationWidth')
var utilities = Object.entries(values).map(([key, value]) => {
return {
[`.${e(`font-variation-width-${key}`)}`]: { 'font-variation-settings': `'wdth' ${value}` },
}
})
addUtilities(utilities)
}),
require('tailwindcss-logical'),
require('@tailwindcss/typography'),
],
}