fix(nuxt3): add support for custom templates (#225)

This commit is contained in:
Daniel Roe 2021-06-16 12:22:01 +01:00 committed by GitHub
parent e2d5a2f4b3
commit 5c67408191
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 10 additions and 0 deletions

View File

@ -30,6 +30,16 @@ export async function generateApp (nuxt: Nuxt, app: NuxtApp) {
data: {} data: {}
} as NuxtTemplate)) } as NuxtTemplate))
// Custom templates (created with addTemplate)
const customTemplates = nuxt.options.build.templates.map(t => ({
path: t.dst,
src: t.src,
data: {
options: t.options
}
}))
app.templates = app.templates.concat(customTemplates)
// Extend templates // Extend templates
await nuxt.callHook('app:templates', app) await nuxt.callHook('app:templates', app)