-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtailwind.config.js
52 lines (48 loc) · 1.51 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
const plugin = require("tailwindcss/plugin");
const configFromTokens = require("./css-utils/config-from-tokens");
const customPropertiesFromTheme = require("./css-utils/custom-properties-from-theme");
const pxToRem = require("./css-utils/px-to-rem");
const valueMap = require("./css-utils/value-map");
const colorTokens = require("./design-tokens/colors.json");
const fontTokens = require("./design-tokens/fonts.json");
const textSizeTokens = require("./design-tokens/text-sizes.json");
const colors = configFromTokens(colorTokens);
const fontSize = valueMap(configFromTokens(textSizeTokens), (size) => {
return `${pxToRem(size)}rem`;
});
const fontFamily = valueMap(configFromTokens(fontTokens), (fonts) => {
// Fontsource appends "Variable" to the name of variable fonts
const variableFonts = ["Inter"];
return fonts.map((font) =>
variableFonts.includes(font) ? `${font}Variable` : font
);
});
/** @type {import('tailwindcss').Config} */
module.exports = {
content: ["./app/**/*.{ts,tsx,jsx,js}"],
theme: {
colors,
fontFamily,
fontSize,
extend: {},
},
// Disables Tailwind's reset etc
corePlugins: {
preflight: false,
},
plugins: [
require("tailwindcss-logical"),
customPropertiesFromTheme({ colors: "color" }),
// Custom utility classes
plugin(({ matchUtilities, theme }) => {
matchUtilities(
{
"flow-space": (value) => {
return { "--flow-space": value };
},
},
{ values: theme("spacing") }
);
}),
],
};