generated from opensafely-core/repo-template
-
Notifications
You must be signed in to change notification settings - Fork 1
/
tailwind.config.js
40 lines (35 loc) · 973 Bytes
/
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
const tailwindForms = require("@tailwindcss/forms");
function addCssVarColors({ addBase, theme }) {
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")),
});
}
/** @type {import('tailwindcss').Config} */
module.exports = {
content: ["sacro/templates/**/*.html", "assets/src/scripts/**/*.js"],
theme: {
extend: {
container: {
center: true,
padding: {
DEFAULT: "1rem",
sm: "1rem",
lg: "2rem",
xl: "3rem",
"2xl": "3rem",
},
},
},
},
plugins: [tailwindForms, addCssVarColors],
};