mahee-auffret/nuxt.config.ts

47 lines
1.1 KiB
TypeScript

// nitro hook to get Directus files working on ssg
// https://github.com/codepie-io/nuxt3-dynamic-routes/blob/main/nuxt.config.ts
// + ssg homemade caching to not retrieve all the files each generation
import { crawlImages } from './ssg_hooks/crawlImages.js'
import { cacheImages } from './ssg_hooks/cacheImages.js'
export default defineNuxtConfig({
devtools: { enabled: true },
modules: [
'@nuxtjs/seo',
],
runtimeConfig: {
apiURL: process.env.DIRECTUS_URL,
apiToken: process.env.DIRECTUS_API_TOKEN
},
nitro: {
hooks: {
async 'prerender:routes'(routes) {
await crawlImages(routes);
},
},
prerender: {
routes: [
'/api/items/global',
]
},
},
hooks: {
'nitro:build:public-assets': async () => {
const imageSizes = [
{ small: 750 },
{ large: 1920 },
];
await cacheImages(imageSizes);
}
},
app: {
pageTransition: { name: 'page', mode: 'out-in' }
},
site: {
url: process.env.URL,
defaultLocale: 'fr',
name: 'Mahée Auffret',
description: 'Portfolio de l\'artiste-peintre basée à Rennes Mahée Auffret'
},
})