-
Notifications
You must be signed in to change notification settings - Fork 0
/
vite.config.ts
30 lines (27 loc) · 924 Bytes
/
vite.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
import { exec } from "child_process"
import { join } from "node:path"
import { sveltekit } from "@sveltejs/kit/vite"
import { defineConfig, type Plugin } from "vite"
export default defineConfig({
plugins: [sveltekit(), errorCss()],
})
function errorCss(): Plugin {
const i = join("src", "lib", "app.css")
const o = join("static", "error.css")
const content = join("src", "error.html")
return {
name: "vite-plugin-svelte-error.html-tailwind-css",
configureServer(server) {
exec(`tailwindcss -i ${i} -o ${o} --content ${content} -m -w`)
server.watcher.add(o)
server.watcher.on("change", (path) => {
if (path === o) {
server.ws.send({ type: "full-reload" })
}
})
},
buildStart() {
exec(`tailwindcss -i ${i} -o ${o} --content ${content} -m`)
},
}
}