forked from t3-oss/create-t3-app
-
Notifications
You must be signed in to change notification settings - Fork 0
/
tailwind.ts
38 lines (30 loc) · 1.22 KB
/
tailwind.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
import path from "path";
import fs from "fs-extra";
import { PKG_ROOT } from "~/consts.js";
import { type Installer } from "~/installers/index.js";
import { addPackageDependency } from "~/utils/addPackageDependency.js";
export const tailwindInstaller: Installer = ({ projectDir }) => {
addPackageDependency({
projectDir,
dependencies: [
"tailwindcss",
"postcss",
"prettier",
"prettier-plugin-tailwindcss",
],
devMode: true,
});
const extrasDir = path.join(PKG_ROOT, "template/extras");
const twCfgSrc = path.join(extrasDir, "config/tailwind.config.ts");
const twCfgDest = path.join(projectDir, "tailwind.config.ts");
const postcssCfgSrc = path.join(extrasDir, "config/postcss.config.cjs");
const postcssCfgDest = path.join(projectDir, "postcss.config.cjs");
const prettierSrc = path.join(extrasDir, "config/_prettier.config.js");
const prettierDest = path.join(projectDir, "prettier.config.js");
const cssSrc = path.join(extrasDir, "src/styles/globals.css");
const cssDest = path.join(projectDir, "src/styles/globals.css");
fs.copySync(twCfgSrc, twCfgDest);
fs.copySync(postcssCfgSrc, postcssCfgDest);
fs.copySync(cssSrc, cssDest);
fs.copySync(prettierSrc, prettierDest);
};