This repository has been archived by the owner on Nov 22, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
nuxt.config.js
95 lines (90 loc) · 1.99 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
const {Client} = require('./config')
let Article
if (process.env.NODE_ENV === 'production' && process.env.BUILD) {
console.log('Generate!')
const models = require('./server/db/model')
Article = models.Article
}
const isBuild = process.env.BUILD === 'true'
console.log('Build:', isBuild)
module.exports = {
/*
** Headers of the page
*/
head: {
title: 'とーふとふのブログ',
meta: [
{ charset: 'utf-8' },
{ name: 'viewport', content: 'width=device-width, initial-scale=1' },
{ hid: 'description', name: 'description', content: 'とーふとふのブログです' }
],
link: [
{ rel: 'icon', type: 'image/png', href: '/favicon.png' },
{ rel: 'stylesheet', href: 'https://fonts.googleapis.com/css?family=Quicksand'},
{ rel: 'stylesheet', href: '/vendor/prismjs/themes/prism.css'}
],
script: [
{src: 'https://platform.twitter.com/widgets.js'}
]
},
/*
** Global CSS
*/
css: ['~/assets/css/main.css'],
/*
** Add axios globally
*/
build: {
vendor: ['axios', 'vue-i18n'],
/*
** Run ESLINT on save
*/
extend (config, ctx) {
if (ctx.isClient) {
config.module.rules.push({
enforce: 'pre',
test: /\.(js|vue)$/,
loader: 'eslint-loader',
exclude: /(node_modules)/
})
}
if (isBuild) {
config.devtool = '#eval'
}
}
},
router: {
middleware: 'i18n'
},
plugins: [
{src: '~/plugins/i18n.js'}
],
modules: [
['@nuxtjs/toast',
{
position: 'top-center',
duaration: 3000
}
],
['@nuxtjs/google-analytics',
{
id: Client.ga
}
],
'@nuxtjs/vendor'
],
vendor: ['prismjs'],
env: {
static: !!process.env.STATIC
},
generate: {
routes () {
return Article.find({state: 'publish'}).select({id: 1})
.then(res => {
return res.map(article => {
return '/posts/' + article.id
})
})
}
}
}