-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnuxt.config.js
228 lines (201 loc) · 4.82 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
import colors from 'vuetify/es5/util/colors'
import pkg from './package'
require('dotenv').config()
const choosePort = (ENVPROD) => {
const NUXT_ENV_PORT_DEV = parseInt(process.env.NUXT_ENV_PORT_DEV) || 50050
const NUXT_ENV_PORT_PREPROD = parseInt(process.env.NUXT_ENV_PORT_PREPROD) || 50051
const NUXT_ENV_PORT_PROD = parseInt(process.env.NUXT_ENV_PORT_PROD) || 50052
if (ENVPROD === 'dev') {
return NUXT_ENV_PORT_DEV
} else if (ENVPROD === 'preprod') {
return NUXT_ENV_PORT_PREPROD
} else if (ENVPROD === 'prod') {
return NUXT_ENV_PORT_PROD
}
}
const buildLocales = () => {
let locales = []
for ( const locale of process.env.NUXT_ENV_LOCALES.split(',') ) {
let localeData = locale.split(':')
let localeObj = {
name: localeData[0],
code: localeData[1],
iso: localeData[2],
file: localeData[2] + '.json'
}
locales.push(localeObj)
}
return locales
}
const configApp = {
/// APP INFOS
appTitle: process.env.NUXT_ENV_APP_TITLE,
// DEV MODE - PORT - HOST ...
mode: process.env.NUXT_ENV_RUN_MODE,
host: process.env.NUXT_ENV_HOST,
port: choosePort(process.env.NUXT_ENV_RUN_MODE),
// INTERNATIONALIZATION
defaultLocale: process.env.NUXT_ENV_LOCALE_DEFAULT,
localesBuild: buildLocales(),
// locales: buildLocales().map(loc => {return loc.code}) ,
// UI
UI_config : {
colors : {
primary: process.env.VUETIFY_primary,
accent: process.env.VUETIFY_accent,
secondary: process.env.VUETIFY_secondary,
info: process.env.VUETIFY_info,
warning: process.env.VUETIFY_warning,
error: process.env.VUETIFY_error,
success: process.env.VUETIFY_success
},
typos : {
}
}
}
// NUXT CONFIG
export default {
mode: 'spa',
/*
** Headers of the page
*/
head: {
titleTemplate: "Nicolas Boeuf",
meta: [
{ charset: 'utf-8' },
{ hid: 'description', name: 'description', content: "Datajournaliste et dévelopeur indépendant"},
{ 'http-equiv': 'Content-Type', content: 'text/html', charset: 'utf-8' },
{ name: 'author', content: 'Nicolas Boeuf' },
{ name: 'robots', content: 'follow, index' },
{
property: 'description',
content: 'Datajournaliste et dévelopeur indépendant'
},
{
property: 'og:type',
content: 'website'
},
{
property: 'og:url',
content: 'http://nicolasboeuf.fr/'
},
{
property: 'og:title',
content: 'Nicolas Boeuf'
},
{
property: 'og:image',
content: 'http://nicolasboeuf.fr/og-share.jpg'
},
{
property: 'og:description',
content: 'Datajournaliste et développeur indépendant'
},
{
property: 'twitter:card',
content: 'summary_large_image'
},
{
property: 'twitter:image',
content: 'http://nicolasboeuf.fr/og-share.jpg'
}
],
link: [
{ rel: 'icon', type: 'image/x-icon', href: 'favicon.ico' }
],
script: [
//{ defer:true, src: 'https://www.googletagmanager.com/gtag/js?id=UA-154669475-1' }
]
},
// for build or dev
// https://nuxtjs.org/faq/host-port/
server: {
port: configApp.port, // 50050
host: configApp.host // XXX.XX.XX.XX
},
// custom env variables for nuxt
// cf : https://github.com/nuxt/nuxt.js/issues/1789
env: {
MODE_APP: configApp.mode,
CONFIG_APP: configApp
},
/*
** Routes and middlewares to load before loading routes
*/
router : {
middleware: [
'setLocales',
'i18n',
],
//base:"/myfolder/"
},
/*
** Customize the progress-bar color
*/
loading: {
color: '#e95522'
},
/*
** Global CSS
*/
css: [
'~/assets/style/app.styl',
'~/assets/css/main.scss',
],
/*
** Plugins to load before mounting the App
*/
plugins: [
'~/plugins/i18n.js',
],
/*
** Nuxt.js modules
*/
modules: [
'@nuxtjs/vuetify',
'@nuxtjs/axios',
'@nuxtjs/pwa',
],
devModules: [
'@nuxtjs/vuetify'
],
/*
** Axios module configuration
** See https://axios.nuxtjs.org/options
*/
axios: {
},
/*
** vuetify module configuration
** https://github.com/nuxt-community/vuetify-module
*/
vuetify: {
theme: {
primary: configApp.UI_config.colors.primary,
secondary: configApp.UI_config.colors.secondary,
accent: configApp.UI_config.colors.accent,
error: configApp.UI_config.colors.error,
warning: configApp.UI_config.colors.warning,
info: configApp.UI_config.colors.info,
success: configApp.UI_config.colors.success
}
},
generate: {
routes: [
'/',
'/en/',
'/fr/',
]
},
/*
** Build configuration
*/
build: {
/*
** You can extend webpack config here
*/
// vendor: ['vue-i18n'],
extend(config, ctx) {
}
}
}