-
Notifications
You must be signed in to change notification settings - Fork 0
/
nuxt.config.js
246 lines (205 loc) · 5.22 KB
/
nuxt.config.js
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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
/*
* SaaS Makers - Web
*
* Copyright 2023, SaaS Makers
* Author: Valerian Saliou https://valeriansaliou.name/
*/
/**************************************************************************
* IMPORTS
* ************************************************************************* */
// NODE
import fs from "fs";
import path from "path";
// NPM
import { defineNuxtConfig } from "nuxt/config";
import merge from "lodash.merge";
// CONFIGURATION
import * as configCommon from "./config/common";
import * as configProduction from "./config/production";
import * as configDevelopment from "./config/development";
// PACKAGE
import * as projectPackage from "./package.json";
/**************************************************************************
* CONFIGURATION
* ************************************************************************* */
const CONFIG = (function () {
const _config = {};
// Load common configuration
merge(_config, configCommon);
// Load configuration for environment
if (process.env.NODE_ENV === "production") {
merge(_config, configProduction);
} else {
merge(_config, configDevelopment);
if (fs.existsSync(path.join(__dirname, "/config/local.json")) === true) {
merge(_config, require("./config/local.json"));
}
}
return _config;
})();
/**************************************************************************
* EXPORTS
* ************************************************************************* */
export default defineNuxtConfig({
// Server-Side Rendering (SSG)
ssr: true,
target: "static",
// Telemetry
telemetry: false,
// General Site Configuration
site: {
url: CONFIG.url.saasmakers_web
},
// Source Directory
srcDir: "src/",
publicDir: "public/",
// Directories
dir: {
assets: "assets",
composables: "composables",
layouts: "layouts",
middleware: "middleware",
modules: "modules",
pages: "pages",
plugins: "plugins",
public: "../public",
static: "static"
},
// CSS Files
css: ["@/assets/stylesheets/all.scss"],
// Auto-import all components as global
components: [{ path: "components", pathPrefix: false }],
// Modules
modules: ["@nuxtjs/robots", "@nuxtjs/sitemap", "nuxt-svgo"],
// Preprocessing
vite: {
css: {
preprocessorOptions: {
scss: {
additionalData: [
'@use "@/assets/stylesheets/variables/all.scss" as *;',
'@use "@/assets/stylesheets/tools/all.scss" as *;'
].join("\n")
}
}
}
},
// Nitro Configuration
nitro: {
publicDir: "public",
output: {
dir: "build",
serverDir: "build/server",
publicDir: "build/public"
}
},
// App Configuration
app: {
rootId: "__saasmakers",
baseURL: "/",
buildAssetsDir: "/_saasmakers/",
// Global page headers
head: {
meta: [
{
charset: "utf-8"
},
{
name: "viewport",
content: "width=device-width, initial-scale=1"
},
{
name: "format-detection",
content: "telephone=no"
},
{
hid: "description",
name: "description",
content:
"Chaque mois, nous parlons d’un sujet SaaS avec un expert du domaine."
}
],
link: [
{
rel: "shortcut icon",
type: "image/x-icon",
href: "/favicons/favicon.ico"
},
{
rel: "icon",
type: "image/png",
href: "/favicons/favicon.png"
},
{
rel: "icon",
type: "image/png",
sizes: "512x512",
href: "/favicons/favicon-512x512.png"
},
{
rel: "icon",
type: "image/png",
sizes: "256x256",
href: "/favicons/favicon-256x256.png"
},
{
rel: "icon",
type: "image/png",
sizes: "192x192",
href: "/favicons/favicon-192x192.png"
},
{
rel: "icon",
type: "image/png",
sizes: "144x144",
href: "/favicons/favicon-144x144.png"
},
{
rel: "icon",
type: "image/png",
sizes: "128x128",
href: "/favicons/favicon-128x128.png"
},
{
rel: "icon",
type: "image/png",
sizes: "32x32",
href: "/favicons/favicon-32x32.png"
}
]
}
},
// Runtime Configuration
runtimeConfig: {
public: {
// Important: remap config as to strip any private token from there, as \
// eg. in the future there might be some private built-time token \
// shared in this configuration file, which we DO NOT want to leak on \
// the Web.
url: CONFIG.url,
platforms: CONFIG.platforms,
tokens: CONFIG.tokens.public,
author: projectPackage.author
}
},
// SVGO Configuration
svgo: {
autoImportPath: false
},
// Sitemap Configuration
sitemap: {
hostname: CONFIG.url.saasmakers_web
},
// Robots Configuration
robots: {
rules: {
UserAgent: "*",
Allow: "/",
Sitemap: `${CONFIG.url.saasmakers_web}/sitemap.xml`
}
},
// Dev Tools Configuration
devtools: {
enabled: true
}
});