-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnuxt.config.ts
91 lines (79 loc) · 2.32 KB
/
nuxt.config.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
import { useStoryblokRawFetchDynamicRoutes } from './composables/useStoryblokRawFetch';
import i18nConfig from './config/i18n.config';
export default defineNuxtConfig({
telemetry: false,
// Disable servenr-side rendering: https://go.nuxtjs.dev/ssr-mode
// ssr: false,
runtimeConfig: {
public: {
STORYBLOK_API_TOKEN: process.env.STORYBLOK_API_TOKEN,
HOSTNAME: process.env.HOSTNAME,
},
},
nitro: {
prerender: {
crawlLinks: true,
routes: ['/', '/sitemap.xml'],
},
},
hooks: {
async 'nitro:config'(nitroConfig) {
if (nitroConfig.dev) { return; }
// ..Async logic..
const dynamicRoutes = await useStoryblokRawFetchDynamicRoutes(process.env.STORYBLOK_API_TOKEN as string);
nitroConfig?.prerender?.routes?.push(...dynamicRoutes);
},
},
app: {
head: {
htmlAttrs: {
lang: 'en',
},
meta: [
{ charset: 'utf-8' },
{ name: 'viewport', content: 'width=device-width, initial-scale=1' },
{ hid: 'description', name: 'description', content: '' },
],
link: [
{ rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' },
],
script: [
{
hid: 'gtm',
children: `(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','${process.env.GTM_ID}');`,
type: 'text/javascript',
},
],
},
},
// Global CSS: https://go.nuxtjs.dev/config-css
css: [
'~/assets/styles/normalize.css',
'~/assets/styles/reset.local.css',
],
// Modules: https://go.nuxtjs.dev/config-modules
modules: [
'@storyblok/nuxt',
'nuxt-jsonld',
'@nuxtjs/i18n', // https://v8.i18n.nuxtjs.org/getting-started/basic-usage
],
storyblok: {
accessToken: process.env.STORYBLOK_API_TOKEN,
useApiClient: true,
apiOptions: { cache: { type: 'memory' } },
},
vite: {
css: {
preprocessorOptions: {
scss: {
additionalData: '@use "@/assets/styles/global-vars" as *;',
},
},
},
},
i18n: i18nConfig,
});