mahee-auffret/nuxt.config.ts

49 lines
1.2 KiB
TypeScript
Raw Normal View History

// 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-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-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
],
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
},
},
prerender: {
routes: [
2024-04-15 23:24:48 +02:00
'/api/items/global',
]
},
2024-04-12 00:23:57 +02:00
},
hooks: {
2024-04-15 23:24:48 +02:00
'nitro:build:public-assets': async () => {
2024-04-16 14:19:14 +02:00
const imageSizes = [
{ small: 750 },
{ large: 1920 },
];
await cacheImages(imageSizes);
}
},
2024-02-21 00:30:14 +01:00
app: {
pageTransition: { name: 'page', mode: 'out-in' }
},
site: {
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
},
})