mirror of
https://github.com/theoludwig/theoludwig.git
synced 2024-11-09 14:51:30 +01:00
Théo LUDWIG
6b29ce9b15
Improvements: - Hide switch theme input (ugly little white square) - i18n without subpath (e.g: /fr or /en), same url whatever the locale used
43 lines
812 B
TypeScript
43 lines
812 B
TypeScript
import fs from 'node:fs'
|
|
|
|
import { defineConfig } from 'vite'
|
|
import { parse as JSONCParser } from 'jsonc-parser'
|
|
import { createHtmlPlugin } from 'vite-plugin-html'
|
|
import date from 'date-and-time'
|
|
|
|
const jsonCurriculumVitaeURL = new URL(
|
|
'./curriculum-vitae.jsonc',
|
|
import.meta.url
|
|
)
|
|
const dataCurriculumVitaeStringJSON = await fs.promises.readFile(
|
|
jsonCurriculumVitaeURL,
|
|
{
|
|
encoding: 'utf-8'
|
|
}
|
|
)
|
|
const curriculumVitae = JSONCParser(dataCurriculumVitaeStringJSON)
|
|
|
|
/**
|
|
* Documentation: <https://vitejs.dev/config/>
|
|
*/
|
|
export default defineConfig({
|
|
build: {
|
|
assetsDir: './'
|
|
},
|
|
plugins: [
|
|
createHtmlPlugin({
|
|
inject: {
|
|
data: {
|
|
date,
|
|
locals: {
|
|
...curriculumVitae
|
|
}
|
|
}
|
|
}
|
|
})
|
|
],
|
|
css: {
|
|
postcss: {}
|
|
}
|
|
})
|