-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathtailwind.config.ts
More file actions
48 lines (43 loc) · 1.32 KB
/
tailwind.config.ts
File metadata and controls
48 lines (43 loc) · 1.32 KB
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
import type { Config } from "tailwindcss";
import palette from "./src/lib/colorPalette";
import typography from "./src/lib/typography";
import tailwindScrollbarHide from "tailwind-scrollbar-hide";
const toKebab = (value: string) =>
value
.replace(/^text/, "")
.replace(/([a-z0-9])([A-Z])/g, "$1-$2")
.replace(/_/g, "-")
.toLowerCase();
const mapColors = () =>
Object.fromEntries(Object.entries(palette).map(([group, shades]) => [group, Object.fromEntries(Object.entries(shades).map(([name, hex]) => [name, hex]))]));
const mapFontSizes = () =>
Object.fromEntries(
Object.entries(typography).flatMap(([scale, variants]) =>
Object.entries(variants).map(([variant, value]) => [
`${toKebab(scale)}-${toKebab(variant)}`,
[
value.fontSize,
{
lineHeight: value.lineHeight,
fontWeight: value.fontWeight.toString(),
},
],
])
)
);
const config: Config = {
content: ["./index.html", "./src/**/*.{js,ts,jsx,tsx}"],
theme: {
extend: {
colors: mapColors(),
fontSize: mapFontSizes(),
fontFamily: {
pretendard: ["Pretendard", "Inter", "Noto Sans KR", "-apple-system", "BlinkMacSystemFont", "Segoe UI", "sans-serif"],
},
},
},
plugins: [
tailwindScrollbarHide
]
};
export default config;