first commit
This commit is contained in:
20 files changed
+1474
No files matched your search
@@ -0,0 +1,19 @@
|
||||
import { defineConfig, loadEnv } from 'vite'
|
||||
import { escapeHtml, resolveSiteConfig } from './src/site-config.js'
|
||||
|
||||
export default defineConfig(({ mode }) => {
|
||||
const config = resolveSiteConfig(loadEnv(mode, process.cwd(), 'VITE_'))
|
||||
|
||||
return {
|
||||
plugins: [{
|
||||
name: 'site-metadata',
|
||||
transformIndexHtml: {
|
||||
order: 'pre',
|
||||
handler(html) {
|
||||
return html.replace(/__SITE_(TITLE|DESCRIPTION)__/g, (_, key) =>
|
||||
escapeHtml(key === 'TITLE' ? config.title : config.metaDescription))
|
||||
},
|
||||
},
|
||||
}],
|
||||
}
|
||||
})
|
||||
Reference in new issue
Block a user