-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtailwind.config.js
74 lines (67 loc) · 2.06 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
/** @type {import('tailwindcss').Config} */
const defaultTheme = require("tailwindcss/defaultTheme");
// import resolveConfig from 'tailwindcss/resolveConfig'
// import tailwindConfig from './tailwind.config.js'
// const defaultTheme = resolveConfig(tailwindConfig).theme;
export default {
content: [
"./src/**/*.{js,jsx,ts,tsx}",
],
theme: {
// spacing: {
// ...defaultTheme.spacing,
// },
fontFamily: {
'sans': ['Lato', 'ui-serif'],
'serif': ['Montserrat', 'ui-serif'],
'heading': ['Montserrat', 'ui-serif'],
'body': ['Lato', 'ui-serif'],
},
extend: {
inset: {
'below-nav': '77px',
},
colors: {
'mos-footer': '#383638',
'mos-red': '#ED3A3A',
},
spacing: {
'mos-xxs': defaultTheme.spacing['1'],
'mos-xs': defaultTheme.spacing['2'],
'mos-sm': defaultTheme.spacing['4'],
'mos-md': defaultTheme.spacing['8'],
'mos-lg': defaultTheme.spacing['16'],
},
maxWidth: {
// 'mos-content': defaultTheme.maxWidth['7xl'],
// TODO: check on how to reference default tailwind value
// max-width-7xl
// 'mos-content': defaultTheme.screens['lg'],
'mos-content': '1024px',
}
},
},
plugins: [
require('@tailwindcss/typography'),
require('@tailwindcss/container-queries'),
function({ addBase, theme }) {
// https://gist.github.com/Merott/d2a19b32db07565e94f10d13d11a8574
// Export color variables
// To use: var(--color-mos-red)
function extractColorVars(colorObj, colorGroup = '') {
return Object.keys(colorObj).reduce((vars, colorKey) => {
const value = colorObj[colorKey];
const newVars =
typeof value === 'string'
? { [`--color${colorGroup}-${colorKey}`]: value }
: extractColorVars(value, `-${colorKey}`);
return { ...vars, ...newVars };
}, {});
}
addBase({
':root': extractColorVars(theme('colors')),
});
},
],
};
console.log(defaultTheme);