- Add full German translations of the three handoff docs (public/*-de.html), each with an "English ↗" toggle; added "Deutsch ↗" toggle to the EN docs. - Register the -de slugs in vite.config.js so the clean URLs work in dev (nginx $uri.html already handles them in prod). dist/ rebuilt. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
40 lines
1.2 KiB
JavaScript
40 lines
1.2 KiB
JavaScript
import { defineConfig } from 'vite'
|
|
import vue from '@vitejs/plugin-vue'
|
|
import tailwindcss from '@tailwindcss/vite'
|
|
import { fileURLToPath, URL } from 'node:url'
|
|
|
|
// Static handoff docs live as flat files in public/ (dev-doc.html etc.).
|
|
// In production nginx rewrites the extensionless path to <name>.html
|
|
// (try_files $uri $uri.html …). This dev-only middleware mirrors that so
|
|
// the same clean URLs (/dev-doc, /simple-doc, /review-doc) work under
|
|
// `vite dev` instead of being swallowed by the SPA history fallback.
|
|
const DOC_SLUGS = [
|
|
'dev-doc', 'simple-doc', 'review-doc',
|
|
'dev-doc-de', 'simple-doc-de', 'review-doc-de',
|
|
]
|
|
function cleanDocUrls() {
|
|
return {
|
|
name: 'clean-doc-urls',
|
|
configureServer(server) {
|
|
server.middlewares.use((req, _res, next) => {
|
|
const path = (req.url || '').split('?')[0].replace(/\/+$/, '')
|
|
const slug = path.replace(/^\/+/, '')
|
|
if (DOC_SLUGS.includes(slug)) req.url = `/${slug}.html`
|
|
next()
|
|
})
|
|
},
|
|
}
|
|
}
|
|
|
|
export default defineConfig({
|
|
plugins: [cleanDocUrls(), vue(), tailwindcss()],
|
|
resolve: {
|
|
alias: {
|
|
'@': fileURLToPath(new URL('./src', import.meta.url)),
|
|
},
|
|
},
|
|
server: {
|
|
port: 5173,
|
|
},
|
|
})
|