forked from antiwork/gumroad
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtailwind.config.js
More file actions
79 lines (72 loc) · 2.16 KB
/
tailwind.config.js
File metadata and controls
79 lines (72 loc) · 2.16 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
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
77
78
79
import fs from "node:fs";
import module from "node:module";
import postcss from "postcss";
import tailwindPlugin from "tailwindcss/plugin";
const require = module.createRequire(import.meta.url);
const scopedPreflightPlugin = (preflightScopeSelector) => {
if (!preflightScopeSelector) {
throw new Error("Selector to manually enable the Tailwind CSS preflight is not provided");
}
let preflightCssPath;
let preflightStyles;
try {
preflightCssPath = require.resolve("tailwindcss/lib/css/preflight.css");
preflightStyles = postcss.parse(fs.readFileSync(preflightCssPath, "utf8"));
} catch {
const minimalPreflightStyles = `
* {
box-sizing: border-box;
margin: 0;
padding: 0;
}
`;
preflightStyles = postcss.parse(minimalPreflightStyles);
}
return tailwindPlugin(({ addBase }) => {
preflightStyles.walkRules((rule) => {
rule.selectors = rule.selectors.map((s) => {
const trimmedSelector = s.trim();
if (trimmedSelector.toLowerCase() === ":root") {
return `${preflightScopeSelector}`;
}
if (trimmedSelector.includes(",")) {
return trimmedSelector
.split(",")
.map((part) => `${preflightScopeSelector} :where(${part.trim()})`)
.join(", ");
}
return `${preflightScopeSelector} :where(${trimmedSelector})`;
});
rule.selector = rule.selectors.join(", ");
});
addBase(preflightStyles.nodes);
});
};
export default {
content: ["./app/javascript/**/*.{ts,tsx}", "./app/views/**/*.erb", "./public/help/**/*.html"],
corePlugins: {
preflight: false,
},
theme: {
extend: {
colors: {
black: "#000000",
white: "#ffffff",
pink: "#ff90e8",
purple: "#90a8ed",
green: "#23a094",
orange: "#ffc900",
red: "#dc341e",
yellow: "#f1f333",
violet: "#b23386",
gray: "#f4f4f0",
"dark-gray": "#242423",
},
boxShadow: {
DEFAULT: "0.25rem 0.25rem 0 currentColor",
lg: "0.5rem 0.5rem 0 currentColor",
},
},
},
plugins: [scopedPreflightPlugin(".scoped-tailwind-preflight")],
};