Skip to content

Commit ab6eba4

Browse files
committed
docs: fix font preload
1 parent 3cbe7a4 commit ab6eba4

File tree

1 file changed

+39
-36
lines changed

1 file changed

+39
-36
lines changed

packages/docs/vite.config.mts

Lines changed: 39 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -306,46 +306,49 @@ export default defineConfig(({ command, mode, isSsrBuild }) => {
306306
// lightweight head-only ssg
307307
name: 'vuetify:ssg',
308308
enforce: 'post',
309-
async transformIndexHtml (html) {
310-
if (mode !== 'production') return html
311-
312-
await fs.mkdir('dist', { recursive: true })
313-
await fs.writeFile(path.join('dist/_fallback.html'), html)
314-
315-
const routes = allRoutes.filter(({ path: route }) => {
316-
return route !== '/' &&
317-
!['/eo-UY/', '/api/', '/user/', ':', '*'].some(v => route.includes(v))
318-
}).map(route => {
319-
const meta = genAppMetaInfo({
320-
title: `${route.meta.title}${route.path === '/en/' ? '' : ' — Vuetify'}`,
321-
description: route.meta.description,
322-
keywords: route.meta.keywords,
309+
transformIndexHtml: {
310+
order: 'post',
311+
async handler (html) {
312+
if (mode !== 'production') return html
313+
314+
await fs.mkdir('dist', { recursive: true })
315+
await fs.writeFile(path.join('dist/_fallback.html'), html)
316+
317+
const routes = allRoutes.filter(({ path: route }) => {
318+
return route !== '/' &&
319+
!['/eo-UY/', '/api/', '/user/', ':', '*'].some(v => route.includes(v))
320+
}).map(route => {
321+
const meta = genAppMetaInfo({
322+
title: `${route.meta.title}${route.path === '/en/' ? '' : ' — Vuetify'}`,
323+
description: route.meta.description,
324+
keywords: route.meta.keywords,
325+
})
326+
const metaContent = [
327+
`<title>${meta.title}</title>`,
328+
...meta.meta.map((v: any) => {
329+
const attrs = Object.keys(v).filter(k => k !== 'key').map(k => `${k}="${v[k]}"`).join(' ')
330+
return `<meta ${attrs}>`
331+
}),
332+
...meta.link.map((v: any) => {
333+
const attrs = Object.keys(v).map(k => `${k}="${v[k]}"`).join(' ')
334+
return `<link ${attrs}>`
335+
}),
336+
].join('\n ')
337+
const content = html.replace('<!-- @inject-meta -->', metaContent)
338+
return {
339+
path: route.path,
340+
content
341+
}
323342
})
324-
const metaContent = [
325-
`<title>${meta.title}</title>`,
326-
...meta.meta.map((v: any) => {
327-
const attrs = Object.keys(v).filter(k => k !== 'key').map(k => `${k}="${v[k]}"`).join(' ')
328-
return `<meta ${attrs}>`
329-
}),
330-
...meta.link.map((v: any) => {
331-
const attrs = Object.keys(v).map(k => `${k}="${v[k]}"`).join(' ')
332-
return `<link ${attrs}>`
333-
}),
334-
].join('\n ')
335-
const content = html.replace('<!-- @inject-meta -->', metaContent)
336-
return {
337-
path: route.path,
338-
content
343+
344+
for (const route of routes) {
345+
const filename = path.join('dist', route.path, 'index.html')
346+
await fs.mkdir(path.dirname(filename), { recursive: true })
347+
await fs.writeFile(filename, route.content)
339348
}
340-
})
341349

342-
for (const route of routes) {
343-
const filename = path.join('dist', route.path, 'index.html')
344-
await fs.mkdir(path.dirname(filename), { recursive: true })
345-
await fs.writeFile(filename, route.content)
350+
return routes.find(r => r.path === '/en/')?.content
346351
}
347-
348-
return routes.find(r => r.path === '/en/')?.content
349352
},
350353
},
351354

0 commit comments

Comments
 (0)