-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
nuxt.config.js
131 lines (118 loc) · 3.34 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
const fs = require('fs')
const sass = require('sass')
const { URL } = require('url')
const config = loadConfig('./config.json')
const { BASE_DIR, GOOGLE_ANALYTICS_UA, TWITTER_ID, OG_IMAGE_PATH, ORIGIN } = config
const BASE_URL = new URL(BASE_DIR, ORIGIN).toString()
const OG_IMAGE_URL = new URL(OG_IMAGE_PATH, BASE_URL).toString()
const TWITTER_ACCOUNT = `@${TWITTER_ID}`
const i18n = require('./nuxt-i18n.config')
const lang = require(`./${i18n.langDir}${i18n.defaultLocale}`)
const APP_NAME = lang.APP_NAME
const APP_DESCRIPTION = lang.APP_DESCRIPTION
module.exports = {
mode: 'spa',
/*
** Headers of the page
*/
head: {
title: APP_NAME,
meta: [
{ charset: 'utf-8' },
{ name: 'viewport', content: 'width=device-width, initial-scale=1' },
{ hid: 'description', name: 'description', content: APP_DESCRIPTION },
{ hid: 'og:type', property: 'og:type', content: 'website' },
{ hid: 'og:title', property: 'og:title', content: APP_NAME },
{ hid: 'og:description', property: 'og:description', content: APP_DESCRIPTION },
{ hid: 'og:url', property: 'og:url', content: BASE_URL },
{ hid: 'og:site_name', property: 'og:title', content: APP_NAME },
{ hid: 'og:image', property: 'og:image', content: OG_IMAGE_URL },
{ hid: 'og:image:width', property: 'og:image:width', content: '256' },
{ hid: 'og:image:height', property: 'og:image:height', content: '256' },
{ hid: 'twitter:card', name: 'twitter:card', content: 'summary' },
{ hid: 'twitter:site', name: 'twitter:site', content: TWITTER_ACCOUNT }
],
link: [
{ rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' },
{ rel: 'icon', type: 'image/png', href: '/favicon-256x256.png', sizes: '256x256' },
{ rel: 'icon', type: 'image/png', href: '/android-chrome-192x192.png', sizes: '192x192' },
{ rel: 'apple-touch-icon', href: '/apple-touch-icon-180x180.png', sizes: '180x180' },
{ rel: 'stylesheet', href: 'https://fonts.googleapis.com/css?family=Roboto:300,400,500,700|Material+Icons|Noto+Sans+JP' },
{ rel: 'stylesheet', href: 'https://use.fontawesome.com/releases/v5.8.1/css/all.css' }
]
},
/*
** Customize the progress-bar color
*/
loading: { color: '#fff' },
/*
** Global CSS
*/
css: [
'~/assets/style/app.styl'
],
/*
** Plugins to load before mounting the App
*/
plugins: [
'@/plugins/vuetify'
],
/*
** Nuxt.js modules
*/
modules: [
['nuxt-i18n', i18n],
['@nuxtjs/google-analytics', {
id: GOOGLE_ANALYTICS_UA
}]
],
/*
** Build configuration
*/
build: {
/*
** You can extend webpack config here
*/
extend (config, ctx) {},
loaders: {
scss: {
implementation: sass
}
}
},
router: {
base: BASE_DIR
},
env: {
config
}
}
function loadConfig (filepath) {
try {
const data = fs.readFileSync(filepath, 'utf-8')
return JSON.parse(data)
} catch (ignored) {
const {
BASE_DIR,
GIFTEE_URL,
GITHUB_SPONSOERS_URL,
GOOGLE_ANALYTICS_UA,
PAYPAL_URL,
TWITTER_ID,
OG_IMAGE_PATH,
ORIGIN,
WISH_LIST_URL
} = process.env
return {
BASE_DIR,
GIFTEE_URL,
GITHUB_SPONSOERS_URL,
GOOGLE_ANALYTICS_UA,
PAYPAL_URL,
TWITTER_ID,
OG_IMAGE_PATH,
ORIGIN,
WISH_LIST_URL
}
}
}