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