-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnuxt.config.js
114 lines (111 loc) · 3.51 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
const webpack = require('webpack')
const axios = require('axios')
const config = {
css: [
{ src: '~assets/css/reset.sass', lang: 'sass' },
{ src: '~assets/css/variables.sass', lang: 'sass' },
{ src: '~assets/css/common.sass', lang: 'sass' },
{ src: '~assets/css/fluffy.scss', lang: 'scss' }
],
/*
** Headers of the page
*/
head: {
title: 'Muxu.Muxu',
meta: [
{ charset: 'utf-8' },
{ name: 'viewport', content: 'width=device-width, initial-scale=1' },
{ hid: 'og:site_name', property: 'og:site_name', content: 'Muxu.Muxu' },
{ hid: 'og:title', property: 'og:title', content: 'Muxu.Muxu' },
{ hid: 'og:image', property: 'og:image', content: 'https://muxumuxu.com/og-image.png' },
{ hid: 'og:url', property: 'og:url', content: 'https://muxumuxu.com/' },
{
hid: 'og:description',
property: 'og:description',
content:
'We help startups and established companies to invent, build, and launch their next product or venture. We also launch ventures of our own.'
},
{ hid: 'twitter:title', property: 'twitter:site', content: '@wearemuxu' },
{ hid: 'twitter:card', property: 'twitter:card', content: 'summary_large_image' },
{ hid: 'twitter:image', property: 'twitter:image', content: 'https://muxumuxu.com/og-image.png' },
{ hid: 'twitter:widgets:theme', property: 'twitter:widgets:theme', content: 'light' },
{ hid: 'twitter:widgets:link-color', property: 'twitter:widgets:link-color', content: '#33CC33' },
{ hid: 'twitter:widgets:border-color', property: 'twitter:widgets:border-color', content: '#33CC33' }
],
link: [
{ rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' },
{ rel: 'preload', href: '/fluffy/fluffy.min.css', as: 'style', onload: "this.rel='stylesheet'" }
],
script: [
{ type: 'text/javascript', id: 'fluffy', async: true, defer: true, src: '/fluffy/fluffy.min.js' }
]
},
modules: [
'@nuxtjs/sitemap'
],
sitemap: {
routes: (callback) => {
const spaceId = process.env.CONTENTFUL_SPACE_ID
const accessToken = process.env.CONTENTFUL_ACCESS_TOKEN
const url = `https://cdn.contentful.com/spaces/${spaceId}/entries?access_token=${accessToken}&content_type=sitemap`
return axios.get(url)
.then(response => {
if (response.data.items.length === 0) {
callback(null, [])
return
}
const sitemap = response.data.items[0]
callback(null, sitemap.fields.urls)
})
.catch(callback)
}
},
/*
** Customize the progress bar color
*/
loading: { color: '#33CC33' },
/*
** Router configuration
*/
router: {
middleware: ['contentful']
},
/*
** Plugin configuration
*/
plugins: [
{ src: '~plugins/hyper-link.js', ssr: true },
{ src: '~plugins/image-hi-res.js', ssr: true },
{ src: '~plugins/webfont.js', ssr: false },
{ src: '~plugins/ga.js', ssr: false },
{ src: '~plugins/console.js', ssr: false}
],
/*
** Build configuration
*/
build: {
/*
** Run ESLint on save
*/
extend(config, ctx) {
if (ctx.isDev && ctx.isClient) {
config.module.rules.push({
enforce: 'pre',
test: /\.(js|vue)$/,
loader: 'eslint-loader',
exclude: /(node_modules)/
})
}
}
}
}
if (process.env.NODE_ENV === 'production') {
// add caching
config.modules.push(
['@nuxtjs/component-cache', {
max: 10000,
maxAge: 1000 * 120
}]
)
}
module.exports = config