2024-04-06 00:46:44 +02:00
|
|
|
// nitro hook to get Directus files working on ssg
|
|
|
|
// https://github.com/codepie-io/nuxt3-dynamic-routes/blob/main/nuxt.config.ts
|
2024-04-12 00:23:57 +02:00
|
|
|
// + ssg homemade caching to not retrieve all the files each generation
|
2024-04-06 00:46:44 +02:00
|
|
|
|
2024-04-15 23:24:48 +02:00
|
|
|
// import { createDirectus, staticToken, rest, readFiles } from '@directus/sdk';
|
|
|
|
|
|
|
|
import { crawlImages } from './ssg_hooks/crawlImages.js'
|
|
|
|
import { cacheImages } from './ssg_hooks/cacheImages.js'
|
2024-04-06 00:46:44 +02:00
|
|
|
|
2024-02-21 00:30:14 +01:00
|
|
|
export default defineNuxtConfig({
|
|
|
|
devtools: { enabled: true },
|
|
|
|
modules: [
|
2024-04-15 23:24:48 +02:00
|
|
|
'@nuxtjs/seo',
|
2024-02-21 00:30:14 +01:00
|
|
|
],
|
2024-04-06 00:46:44 +02:00
|
|
|
runtimeConfig: {
|
|
|
|
apiURL: process.env.DIRECTUS_URL,
|
|
|
|
apiToken: process.env.DIRECTUS_API_TOKEN
|
|
|
|
},
|
|
|
|
nitro: {
|
|
|
|
hooks: {
|
|
|
|
async 'prerender:routes'(routes) {
|
2024-04-15 23:24:48 +02:00
|
|
|
await crawlImages(routes);
|
2024-04-12 00:23:57 +02:00
|
|
|
},
|
|
|
|
},
|
2024-04-12 16:14:02 +02:00
|
|
|
prerender: {
|
|
|
|
routes: [
|
2024-04-15 23:24:48 +02:00
|
|
|
'/api/items/global',
|
2024-04-12 16:14:02 +02:00
|
|
|
]
|
|
|
|
},
|
2024-04-12 00:23:57 +02:00
|
|
|
},
|
|
|
|
hooks: {
|
2024-04-15 23:24:48 +02:00
|
|
|
'nitro:build:public-assets': async () => {
|
|
|
|
await cacheImages();
|
2024-04-06 00:46:44 +02:00
|
|
|
}
|
|
|
|
},
|
2024-02-21 00:30:14 +01:00
|
|
|
app: {
|
|
|
|
pageTransition: { name: 'page', mode: 'out-in' }
|
|
|
|
},
|
|
|
|
site: {
|
2024-02-21 01:21:11 +01:00
|
|
|
url: process.env.URL,
|
2024-02-21 00:30:14 +01:00
|
|
|
defaultLocale: 'fr',
|
|
|
|
name: 'Mahée Auffret',
|
|
|
|
description: 'Portfolio de l\'artiste-peintre basée à Rennes Mahée Auffret'
|
2024-04-15 23:24:48 +02:00
|
|
|
},
|
|
|
|
})
|