tailwind.config.cjs 2.8 K raw
1
const { fontFamily } = require("tailwindcss/defaultTheme");
2
const plugin = require("tailwindcss/plugin");
3
4
/** @type {import('tailwindcss').Config} */
5
module.exports = {
6
	content: ["./src/**/*.{astro,html,js,jsx,md,svelte,ts,tsx,vue}"],
7
	darkMode: "class",
8
	corePlugins: {
9
		// disable aspect ratio as per docs -> @tailwindcss/aspect-ratio
10
		aspectRatio: false,
11
		// disable some core plugins as they are included in the css, even when unused
12
		touchAction: false,
13
		ringOffsetWidth: false,
14
		ringOffsetColor: false,
15
		scrollSnapType: false,
16
		borderOpacity: false,
17
		textOpacity: false,
18
		fontVariantNumeric: false,
19
	},
20
	theme: {
21
		extend: {
22
			colors: {
23
				bgColor: "var(--theme-bg)",
24
				textColor: "var(--theme-text)",
25
				link: "var(--theme-link)",
26
				accent: "var(--theme-accent)",
27
				"accent-2": "var(--theme-accent-2)",
28
			},
29
			fontFamily: {
30
				// Add any custom fonts here
31
				sans: [...fontFamily.sans],
32
				serif: [...fontFamily.serif],
33
			},
34
			transitionProperty: {
35
				height: "height",
36
			},
37
			typography: (theme) => ({
38
				cactus: {
39
					css: {
40
						"--tw-prose-body": "var(--theme-text)",
41
						"--tw-prose-headings": "var(--theme-accent-2)",
42
						"--tw-prose-links": "var(--theme-text)",
43
						"--tw-prose-bold": "var(--theme-text)",
44
						"--tw-prose-bullets": "var(--theme-text)",
45
						"--tw-prose-quotes": "var(--theme-quote)",
46
						"--tw-prose-code": "var(--theme-text)",
47
						"--tw-prose-hr": "0.5px dashed #666",
48
						"--tw-prose-th-borders": "#666",
49
					},
50
				},
51
				DEFAULT: {
52
					css: {
53
						a: {
54
							"@apply cactus-link no-underline": "",
55
						},
56
						strong: {
57
							fontWeight: "700",
58
						},
59
						code: {
60
							border: "1px dotted #666",
61
							borderRadius: "2px",
62
						},
63
						blockquote: {
64
							borderLeftWidth: "none",
65
						},
66
						hr: {
67
							borderTopStyle: "dashed",
68
						},
69
						thead: {
70
							borderBottomWidth: "none",
71
						},
72
						"thead th": {
73
							fontWeight: "700",
74
							borderBottom: "1px dashed #666",
75
						},
76
						"tbody tr": {
77
							borderBottomWidth: "none",
78
						},
79
						tfoot: {
80
							borderTop: "1px dashed #666",
81
						},
82
					},
83
				},
84
				sm: {
85
					css: {
86
						code: {
87
							fontSize: theme("fontSize.sm")[0],
88
							fontWeight: "400",
89
						},
90
					},
91
				},
92
			}),
93
		},
94
	},
95
	plugins: [
96
		require("@tailwindcss/typography"),
97
		require("@tailwindcss/line-clamp"),
98
		require("@tailwindcss/aspect-ratio"),
99
		plugin(function ({ addComponents }) {
100
			addComponents({
101
				".cactus-link": {
102
					"@apply bg-[size:100%_6px] bg-bottom bg-repeat-x": {},
103
					backgroundImage:
104
						"linear-gradient(transparent,transparent 5px,var(--theme-text) 5px,var(--theme-text))",
105
					"&:hover": {
106
						backgroundImage:
107
							"linear-gradient(transparent,transparent 4px,var(--theme-link) 4px,var(--theme-link))",
108
					},
109
				},
110
				".title": {
111
					"@apply text-2xl font-semibold text-accent-2": {},
112
				},
113
			});
114
		}),
115
	],
116
};