-
Notifications
You must be signed in to change notification settings - Fork 0
/
nuxt.config.js
150 lines (142 loc) · 4.52 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
const path = require('path');
const variables = require(path.join(__dirname, 'assets/variables'));
// const ScrollToPlugin = require('gsap/src/uncompressed/plugins/ScrollToPlugin');
// const ScrollToPlugin = require(path.join(__dirname, 'utilities/ScrollToPlugin'));
// console.log('ScrollToPlugin', ScrollToPlugin);
module.exports = {
/*
** Headers of the page
*/
head: {
htmlAttrs: {
lang: 'en'
},
title: 'Robert Bue',
meta: [
{ charset: 'utf-8' },
{ name: 'viewport', content: 'width=device-width, initial-scale=1' },
{ name: 'theme-color', content: '#112b3a' },
{ hid: 'description', name: 'description', content: 'Award-winning technologist living in Oslo, Norway.' },
{ hid: 'author', name: 'author', content: 'Robert Bue' },
{ name: 'og:title', content: 'Robert Bue' },
{ name: 'og:description', content: `Award-winning technologist living in Oslo, Norway.` },
{ name: 'og:image', content: '~/static/images/2022/robert-bue.jpg' }
],
script: [
{ src: 'https://cdnjs.cloudflare.com/ajax/libs/pixi.js/5.1.3/pixi.min.js' }
],
link: [
// { rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' },
{ rel: 'apple-touch-icon', sizes: '180x180', href: '/images/apple-touch-icon.png' },
{ rel: 'icon', type: 'image/png', sizes: '16x16', href: '/images/favicon-16x16.png' },
{ rel: 'icon', type: 'image/png', sizes: '32x32', href: '/images/favicon-32x32.png' },
// { rel: 'stylesheet', href: 'https://fonts.googleapis.com/css?family=Raleway:400,500,600,700' },
// { rel: 'stylesheet', href: 'https://fonts.googleapis.com/css?family=Barlow' },
// { rel: 'stylesheet', href: 'https://fonts.googleapis.com/css?family=Alegreya' },
// { rel: 'stylesheet', href: 'https://fonts.googleapis.com/css?family=Raleway:400,500,600,700' },
// { rel: 'stylesheet', href: 'https://fonts.googleapis.com/css?family=Raleway:400,500,600,700' },
// { rel: 'stylesheet', href: 'https://fonts.googleapis.com/css?family=Montserrat:400,500,600,700|Prata|Quicksand:400,500,600,700|Roboto:400,500,700|Source+Sans+Pro:400,600,700&display=swap' },
{ rel: 'stylesheet', href: 'https://fonts.googleapis.com/css?family=Prata|Source+Sans+Pro:400,600' },
{ rel: 'stylesheet', href: 'https://use.typekit.net/tia6ylu.css' }
]
},
/*
** Customize the progress bar color
*/
loading: { color: '#ffecb5' }, // ffc87f // e0caca
// loading: '~/components/Loading.vue',
// loading: false,
transition: {
css: false
},
router: {
scrollBehavior: function (to, from, savedPosition) {
return true;
// savedPosition is only available for popstate navigations.
if (savedPosition) {
return savedPosition
} else {
let position = {}
console.log(to, from, savedPosition);
// if no children detected
if (to.matched.length < 2) {
// scroll to the top of the page
position = { x: 0, y: 0 }
TweenMax.to(window, 2, { scrollTo: 100 });
}
else if (to.matched.some((r) => r.components.default.options.scrollToTop)) {
// if one of the children has scrollToTop option set to true
position = { x: 0, y: 0 }
TweenMax.to(window, 2, { scrollTo: 200 });
}
// if link has anchor, scroll to anchor by returning the selector
if (to.hash) {
position = { selector: to.hash }
TweenMax.to(window, 2, { scrollTo: 300 });
}
//return position
}
}
/*
Return to component and resolve the promise there?
scrollBehavior (to, from, savedPosition) {
return new Promise((resolve, reject) => {
setTimeout(() => {
resolve({ x: 0, y: 0 })
}, 500)
})
}
*/
},
/*
** Plugins
*/
modules: [
// ['nuxt-sass-resources-loader', path.resolve(__dirname, 'assets/css/main.scss')]
],
/*
** Plugins
*/
plugins: [
{ src: '~/plugins/ga.js', ssr: false },
{ src: '~/plugins/global.js', ssr: true },
{ src: '~/plugins/locomotive-scroll.js', ssr: false, mode: 'client' }
],
/*
** CSS
*/
css: [
'normalize.css',
'~/assets/css/base.css'
],
/*
** Build configuration
*/
build: {
transpile: ['locomotive-scroll'],
resolve: {
alias: {
ScrollToPlugin: path.resolve('node_modules', 'gsap/ScrollToPlugin.js')
}
},
vendor: ['gsap', path.resolve('node_modules', 'gsap/ScrollToPlugin.js')],
postcss: {
plugins: {
'postcss-cssnext': {
features: {
customProperties: {
variables: variables
},
customMedia: {
extensions: variables.mediaRanges
}
}
},
'lost': {},
'postcss-pxtorem': {
propList: ['*']
}
}
}
}
};