-
Notifications
You must be signed in to change notification settings - Fork 1
/
vite.config.local.ts
67 lines (61 loc) · 1.97 KB
/
vite.config.local.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
/// <reference types="vite/client" />
import react from "@vitejs/plugin-react";
import tailwindCss from "tailwindcss";
import { defineConfig, loadEnv } from "vite";
import checker from "vite-plugin-checker";
import { createHtmlPlugin } from "vite-plugin-html";
import { htmlInjectionPlugin } from "vite-plugin-html-injection";
import globaliseHtmlInjectionPluginConfig from "./src/projects/globalise/config/htmlInjectionPluginConfig.json";
import republicHtmlInjectionPluginConfig from "./src/projects/republic/config/htmlInjectionPluginConfig.json";
export default defineConfig(({ mode }) => {
const env = loadEnv(mode, process.cwd(), "");
let tailwindConfig: string;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
let htmlInjectionPluginConfig: any;
switch (env.VITE_PROJECT) {
case "republic":
tailwindConfig = "tailwind.config.republic.js";
htmlInjectionPluginConfig = republicHtmlInjectionPluginConfig;
break;
case "mondriaan":
tailwindConfig = "tailwind.config.mondriaan.js";
break;
case "globalise":
tailwindConfig = "tailwind.config.globalise.js";
htmlInjectionPluginConfig = globaliseHtmlInjectionPluginConfig;
break;
case "translatin":
tailwindConfig = "tailwind.config.translatin.js";
break;
case "suriano":
tailwindConfig = "tailwind.config.suriano.js";
break;
case "hooft":
tailwindConfig = "tailwind.config.hooft.js";
break;
case "vangogh":
tailwindConfig = "tailwind.config.vangogh.js";
break;
default:
tailwindConfig = "tailwind.default.config.js";
}
return {
plugins: [
createHtmlPlugin(),
react(),
checker({
typescript: true,
overlay: {
initialIsOpen: false,
},
}),
htmlInjectionPluginConfig &&
htmlInjectionPlugin(htmlInjectionPluginConfig),
],
css: {
postcss: {
plugins: [tailwindCss(tailwindConfig)],
},
},
};
});