2023-10-23 23:11:59 +02:00
|
|
|
import fs from "node:fs"
|
2022-07-28 21:20:41 +02:00
|
|
|
|
2023-10-23 23:11:59 +02:00
|
|
|
import { defineConfig } from "vite"
|
|
|
|
import { parse as JSONCParser } from "jsonc-parser"
|
|
|
|
import { createHtmlPlugin } from "vite-plugin-html"
|
|
|
|
import date from "date-and-time"
|
2022-07-28 21:20:41 +02:00
|
|
|
|
2023-07-28 11:53:04 +02:00
|
|
|
const jsonCurriculumVitaeURL = new URL(
|
2023-10-23 23:11:59 +02:00
|
|
|
"./curriculum-vitae.jsonc",
|
|
|
|
import.meta.url,
|
2023-07-28 11:53:04 +02:00
|
|
|
)
|
|
|
|
const dataCurriculumVitaeStringJSON = await fs.promises.readFile(
|
|
|
|
jsonCurriculumVitaeURL,
|
|
|
|
{
|
2023-10-23 23:11:59 +02:00
|
|
|
encoding: "utf-8",
|
|
|
|
},
|
2023-07-28 11:53:04 +02:00
|
|
|
)
|
|
|
|
const curriculumVitae = JSONCParser(dataCurriculumVitaeStringJSON)
|
2022-07-28 21:20:41 +02:00
|
|
|
|
2022-11-29 10:29:02 +01:00
|
|
|
/**
|
|
|
|
* Documentation: <https://vitejs.dev/config/>
|
|
|
|
*/
|
2022-07-28 21:20:41 +02:00
|
|
|
export default defineConfig({
|
|
|
|
build: {
|
2023-10-23 23:11:59 +02:00
|
|
|
assetsDir: "./",
|
2022-07-28 21:20:41 +02:00
|
|
|
},
|
|
|
|
plugins: [
|
|
|
|
createHtmlPlugin({
|
|
|
|
inject: {
|
|
|
|
data: {
|
|
|
|
date,
|
|
|
|
locals: {
|
2023-10-23 23:11:59 +02:00
|
|
|
...curriculumVitae,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}),
|
2022-07-28 21:20:41 +02:00
|
|
|
],
|
|
|
|
css: {
|
2023-10-23 23:11:59 +02:00
|
|
|
postcss: {},
|
|
|
|
},
|
2022-07-28 21:20:41 +02:00
|
|
|
})
|