-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtailwind.config.js
59 lines (52 loc) · 1.34 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
const parseCustomProperties = require('./utilities/parse-css-custom-properties');
const breakpoints = require('./assets/js/breakpoints');
const screens = Object.entries(breakpoints).reduce(
(accumulator, [name, { em }]) => ({
...accumulator,
[name]: `${em}em`,
[`<${name}`]: { max: `${em - 0.0000000001}em` },
}),
{},
);
const customProperties = parseCustomProperties();
const extractProperties = (customProperties, prefix) =>
Object.entries(customProperties).reduce((acc, [prop, value]) => {
if (prop.startsWith(prefix)) {
return {
...acc,
[prop.replace(prefix, '')]: value,
};
}
return acc;
}, {});
const colors = extractProperties(customProperties, '--color-');
const fontSize = extractProperties(customProperties, '--font-size-');
const spacing = extractProperties(customProperties, '--spacing-');
module.exports = {
purge: false,
theme: {
screens,
colors: {
...colors,
transparent: 'transparent',
'current-color': 'currentColor',
},
fontSize,
spacing,
inset: {
...spacing,
...Object.entries(spacing).reduce(
(acc, [name, value]) => ({
...acc,
[`-${name}`]: `-${value}`,
}),
{},
),
full: '100%',
'1/2': '50%',
},
},
variants: {
padding: ['responsive', 'first'],
},
};