forked from t3-oss/create-t3-app
-
Notifications
You must be signed in to change notification settings - Fork 0
/
tailwind.ts
32 lines (25 loc) · 1.12 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
import fs from "fs-extra";
import path from "path";
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", "autoprefixer"],
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 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);
// Remove vanilla css file
const indexModuleCss = path.join(projectDir, "src/pages/index.module.css");
fs.unlinkSync(indexModuleCss);
};