-
Notifications
You must be signed in to change notification settings - Fork 24
/
tailwind.config.ts
76 lines (72 loc) · 2.83 KB
/
tailwind.config.ts
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
75
76
import type { Config } from "tailwindcss";
import defaultTheme from "tailwindcss/defaultTheme";
import plugin from "tailwindcss/plugin";
const config: Config = {
content: [
"./pages/**/*.{js,ts,jsx,tsx,mdx}",
"./components/**/*.{js,ts,jsx,tsx,mdx}",
"./public/code/**/*.{js,ts,jsx,tsx,mdx}",
"./app/**/*.{js,ts,jsx,tsx,mdx}",
],
theme: {
extend: {
fontFamily: {
sans: ["Hex Franklin", ...defaultTheme.fontFamily.sans],
},
colors: {
buttondown: "#0069ff",
},
},
},
plugins: [
plugin(function ({ addVariant, addComponents, matchUtilities }) {
// These variants allow us to style links based on their href
// For example, we could bold all links to the glossary by using the glossary variant:
// <a href='/glossary-api class="glossary:font-bold">API</a>
// This seems overkill on its own — why not just manually do this? — but it's useful
// combined with the `prose` plugin, which automatically styles Markdown text. It lets us
// write things like:
// <div class="prose glossary:prose-a:font-bold">
// This is a paragraph with a [link to the glossary](/glossary-api).
// </div>
// And have the link styled in a consistent way without having to manually scour the rendered Markdown.
addVariant("glossary", '&[href*="glossary-"]');
addVariant("app-link", '&[href*="https://buttondown.com"]');
addVariant("github", '&[href*="https://github.com"]');
addVariant("pricing", '&[href*="https://buttondown.com/pricing"]');
// This component allows us to add arbitrary masks to elements, like as follows:
// <div class="mask-image:url(/path/to/image.png)"></div>
// This is useful for adding icons to links, like so:
// <a href="https://buttondown.com" class="notable-link mask-image:url(/path/to/icon.png)">Buttondown</a>
matchUtilities({
mask: (value) => ({
maskImage: value,
}),
});
// This styles links with a background image and a hover effect. It looks overkill,
// but the reason we do it _here_ and not in a global CSS file is because we want to apply
// the rule based on those variants declared above.
addComponents({
".notable-link": {
position: "relative",
"&:after": {
content: '""',
display: "inline-block",
backgroundSize: "contain",
backgroundRepeat: "no-repeat",
marginLeft: "0.25em",
width: "16px",
height: "16px",
color: "inherit",
backgroundColor: "currentColor",
maskPosition: "center",
maskSize: "16px",
maskRepeat: "no-repeat",
},
},
});
}),
require("@tailwindcss/typography"),
],
};
export default config;