-
Notifications
You must be signed in to change notification settings - Fork 3
/
vite.css-config.ts
35 lines (34 loc) · 1.14 KB
/
vite.css-config.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
import { resolve } from "path"
import { defineConfig } from "vite"
/*
* this config file takes care of building the css files
*
* it is meant to be run just after the react build, as it doesn't empty the dist/ folder
* it uses the postcss config in postcss.config.mjs
*
* see vite.config.ts for the react files
*/
export default defineConfig({
base: "",
build: {
emptyOutDir: false,
rollupOptions: {
input: {
"css-prefixed-dsfr": resolve(__dirname, "src/styles/prefixed-dsfr.css"),
"css-raw-dsfr": resolve(__dirname, "src/styles/raw-dsfr.css"),
"css-homepage": resolve(__dirname, "src/styles/homepage.css"),
"css-gaufre": resolve(__dirname, "src/styles/gaufre.css"),
"css-homepage-full": resolve(__dirname, "src/styles/homepage-full.css"),
"css-homepage-gaufre": resolve(__dirname, "src/styles/homepage-gaufre.css"),
},
output: {
assetFileNames: (arg) => {
if (arg.name?.startsWith("css-") && arg.name.endsWith(".css")) {
return `css/${arg.name.substring(4)}`
}
return `css/assets/[name][extname]`
},
},
},
},
})