This repository has been archived by the owner on Feb 29, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
tailwind.config.js
106 lines (92 loc) · 3.21 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
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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
// @ts-check
const plugin = require("tailwindcss/plugin");
const fs = typeof window === "undefined" ? require("fs") : null;
const { fontFamily } = require("tailwindcss/defaultTheme");
/** @type {import('tailwindcss').Config} */
module.exports = {
mode: "jit",
content: [
"./src/**/*.{js,ts,jsx,tsx}", //
],
corePlugins: {
container: false,
},
theme: {
extend: {
fontFamily: {
manrope: ["var(--font-manrope)", ...fontFamily.sans],
},
colors: {
dark: {
50: "#FFFFFF",
100: "#F4F6F7",
200: "#E1E7EB",
300: "#CED7DC",
400: "#6C8698",
500: "#4B5E69",
600: "#2F3B42",
700: "#212C32",
800: "#191F23",
900: "#151B1E",
},
},
screens: {
"3xl": "1920px",
},
},
},
plugins: [
require("@tailwindcss/typography"),
require("@tailwindcss/line-clamp"),
/**
* @description
* Registering all classes from a css file into Tailwind CSS IntelliSense
*
* @note
* After changing the css file, you need to save this file to update the IntelliSense
* or by using "Developer: Reload Window" or "Developer: Restart Extension Host" command in VSCode
*/
plugin(async ({ addComponents }) => {
if (!fs) return;
const findAllCSSFiles = (/** @type {string} */ path) => {
/** @type {any[]} */
let cssFiles = [];
if (fs.lstatSync(path).isDirectory()) {
const filesOrFolders = fs.readdirSync(path);
filesOrFolders.forEach((file) => {
const filePath = `${path}/${file}`;
cssFiles = cssFiles.concat(findAllCSSFiles(filePath));
});
} else {
if (path.endsWith(".css")) {
cssFiles.push(path);
}
}
return cssFiles;
};
for (const cssFilePath of findAllCSSFiles("./src")) {
const data = fs.readFileSync(cssFilePath, {
encoding: "utf-8",
flag: "r",
});
// get all classes using regex
const regex = /^\s+?\.[a-zA-Z0-9-]+/gm;
const classes = data.match(regex);
if (classes) {
/** @type {string[]} */
let registeredClasses = [];
for (const rawClassName of classes) {
const className = rawClassName.trim();
if (registeredClasses.includes(className)) {
continue;
}
addComponents({
[className]: {},
});
registeredClasses.push(className);
}
}
}
}),
],
};