mirror of
https://gitlab.dit.htwk-leipzig.de/htwk-software/htwkalender.git
synced 2025-08-07 04:09:15 +02:00
feat:#72 add footer and commit id injection
This commit is contained in:
@@ -23,9 +23,18 @@ import terser from "@rollup/plugin-terser";
|
||||
import generateSitemap from "vite-ssg-sitemap";
|
||||
import vueDevTools from "vite-plugin-vue-devtools";
|
||||
import { ViteSSGOptions } from "vite-ssg";
|
||||
import fs from "fs";
|
||||
|
||||
const hostname = "https://cal.htwk-leipzig.de";
|
||||
|
||||
// fallback
|
||||
let commitHash = "unknown"
|
||||
if (fs.existsSync('.env.commit')) {
|
||||
const env = fs.readFileSync('.env.commit', 'utf-8')
|
||||
const match = env.match(/COMMIT_HASH=(.+)/)
|
||||
if (match) commitHash = match[1]
|
||||
}
|
||||
|
||||
// https://vitejs.dev/config/
|
||||
export default defineConfig({
|
||||
plugins: [vue(), resolve(), terser(), vueDevTools()],
|
||||
@@ -45,6 +54,9 @@ export default defineConfig({
|
||||
".scss",
|
||||
],
|
||||
},
|
||||
define: {
|
||||
__COMMIT_HASH__: JSON.stringify(commitHash),
|
||||
},
|
||||
ssgOptions: <ViteSSGOptions>{
|
||||
script: "async",
|
||||
formatting: "minify",
|
||||
|
Reference in New Issue
Block a user