-
Notifications
You must be signed in to change notification settings - Fork 0
/
nuxt.config.js
199 lines (183 loc) · 7.01 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
import fs from 'fs'
import dotenv from 'dotenv'
import axios from 'axios'
dotenv.config({ path: '.env' })
function saveImage(image, name) {
if (!image) {
return
}
axios(image, { responseType: 'arraybuffer' })
.then(res => {
fs.writeFile(
`assets/images/${name}`, res.data, 'binary', (err) => {
if (err) {
console.log(err)
return
}
}
)
})
}
axios(process.env.API_URL + '/general_settings/1')
.then(res => {
const { header_background_image, header_profile_picture } = res.data
saveImage(header_background_image, 'hieronta-jyvaskyla.webp')
saveImage(header_profile_picture, 'hieroja-jyvaskyla.webp')
})
export default {
// Target: https://go.nuxtjs.dev/config-target
target: 'static',
// Global page headers: https://go.nuxtjs.dev/config-head
head: {
title: 'Koulutettu hieroja Ninja Marttinen – Jyväskylä, Kuokkala',
htmlAttrs: {
lang: 'fi'
},
meta: [
{ charset: 'utf-8' },
{ name: 'viewport', content: 'width=device-width, initial-scale=1' },
{ hid: 'description', name: 'description', content: 'Laadukasta ja monipuolista hierontaa Jyväskylän Kuokkalassa. Olen sekä koulutettu hieroja että urheiluhieroja. Tule hierontaan nauttimaan omasta ajastasi!' },
{ name: 'robots', content: 'index, follow' },
// Open Graph / Facebook
{ name: 'og:type', content: 'website' },
{ name: 'og:url', content: 'https://ninjamarttinen.fi' },
{ name: 'og:title', content: 'Koulutettu hieroja Ninja Marttinen – Jyväskylä, Kuokkala' },
{ name: 'og:description', content: 'Laadukasta ja monipuolista hierontaa Jyväskylän Kuokkalassa. Olen sekä koulutettu hieroja että urheiluhieroja. Tule hierontaan nauttimaan omasta ajastasi!' },
{ name: 'og:image', content: 'https://kennyhei1.eu.pythonanywhere.com/media/hieroja-jyvaskyla.webp' },
// Twitter
{ name: 'twitter:card', content: 'summary_large_image' },
{ name: 'twitter:url', content: 'https://ninjamarttinen.fi' },
{ name: 'twitter:title', content: 'Koulutettu hieroja Ninja Marttinen – Jyväskylä, Kuokkala' },
{ name: 'twitter:description', content: 'Laadukasta ja monipuolista hierontaa Jyväskylän Kuokkalassa. Olen sekä koulutettu hieroja että urheiluhieroja. Tule hierontaan nauttimaan omasta ajastasi!' },
{ name: 'twitter:image', content: 'https://kennyhei1.eu.pythonanywhere.com/media/hieroja-jyvaskyla.webp' },
],
link: [
{ rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' },
{ rel: 'apple-touch-icon', type: 'image/png', sizes: '57x57', href: '/icons/apple-icon-57x57.png' },
{ rel: 'apple-touch-icon', type: 'image/png', sizes: '60x60', href: '/icons/apple-icon-60x60.png' },
{ rel: 'apple-touch-icon', type: 'image/png', sizes: '72x72', href: '/icons/apple-icon-72x72.png' },
{ rel: 'apple-touch-icon', type: 'image/png', sizes: '76x76', href: '/icons/apple-icon-76x76.png' },
{ rel: 'apple-touch-icon', type: 'image/png', sizes: '114x114', href: '/icons/apple-icon-114x114.png' },
{ rel: 'apple-touch-icon', type: 'image/png', sizes: '120x120', href: '/icons/apple-icon-120x120.png' },
{ rel: 'apple-touch-icon', type: 'image/png', sizes: '144x144', href: '/icons/apple-icon-144x144.png' },
{ rel: 'apple-touch-icon', type: 'image/png', sizes: '152x152', href: '/icons/apple-icon-152x152.png' },
{ rel: 'apple-touch-icon', type: 'image/png', sizes: '180x180', href: '/icons/apple-icon-180x180.png' },
{ rel: 'icon', type: 'image/png', sizes: '32x32', href: '/icons/favicon-32x32.png' },
{ rel: 'icon', type: 'image/png', sizes: '96x96', href: '/icons/favicon-96x96.png' }
]
},
// Global CSS: https://go.nuxtjs.dev/config-css
css: [
'animate.css',
'@/assets/css/global.scss'
],
// Plugins to run before rendering page: https://go.nuxtjs.dev/config-plugins
plugins: [
//'@/plugins/vue-gtag.js'
],
// Auto import components: https://go.nuxtjs.dev/config-components
// i.e. no need to do this: "import [component] from [path]"
components: false,
// Modules for dev and build (recommended): https://go.nuxtjs.dev/config-modules
buildModules: [
// https://go.nuxtjs.dev/eslint
// '@nuxtjs/eslint-module',
// '@nuxtjs/google-analytics',
'nuxt-purgecss'
],
// Modules: https://go.nuxtjs.dev/config-modules
modules: [
// https://go.nuxtjs.dev/buefy
'nuxt-buefy',
'@nuxtjs/robots',
'@nuxtjs/sitemap'
],
// Sitemap
sitemap: {
hostname: 'https://ninjamarttinen.fi',
defaults: {
changefreq: 'weekly',
priority: 1,
lastmod: new Date()
}
},
publicRuntimeConfig: {
googleAnalytics: {
id: process.env.GOOGLE_ANALYTICS_ID
}
},
// PurgeCSS
purgeCSS: {
enabled: true,
// Scan CSS classes from these paths and
// do not purge them if they are in use
paths: [
'components/**/*.vue',
'layouts/**/*.vue',
'pages/**/*.vue',
'plugins/**/*.js',
// bulma
// 'node_modules/bulma/css/bulma.min.css',
// b-navbar
'node_modules/buefy/src/components/navbar/*.vue',
'node_modules/buefy/src/scss/components/_navbar.scss',
// b-tooltip
'node_modules/buefy/src/components/tooltip/*.vue',
'node_modules/buefy/src/scss/components/_tooltip.scss',
// b-icon
'node_modules/buefy/src/components/icon/*.vue',
'node_modules/buefy/src/scss/components/_icon.scss',
// b-button
'node_modules/buefy/src/components/button/*.vue',
// b-collapse
'node_modules/buefy/src/components/collapse/*.vue',
// b-notification
'node_modules/buefy/src/components/notification/*.vue',
],
styleExtensions: ['.css', '.scss'],
safelist: ['animate__animated', 'animate__fadeIn']
},
// Build Configuration: https://go.nuxtjs.dev/config-build
build: {
},
generate: {
subFolders: true
},
router: {
base: '/',
scrollBehavior: async (to, from, savedPosition) => {
if (savedPosition) {
return savedPosition
}
const findEl = async (hash, x) => {
return document.querySelector(hash) ||
new Promise((resolve, reject) => {
if (x > 50) {
return resolve()
}
setTimeout(() => { resolve(findEl(hash, ++x || 1)) }, 100)
})
}
if (to.hash) {
const el = await findEl(to.hash)
let top = el.getBoundingClientRect().top + document.documentElement.scrollTop - 50
const scrollPosition = document.documentElement.scrollTop
const isFixedNavbar = document.querySelector('.navbar.is-fixed-top')
if (
scrollPosition < 20 &&
from.name === 'index' &&
window.innerWidth < 460 &&
!isFixedNavbar
) {
top -= 218
}
if ('scrollBehavior' in document.documentElement.style) {
return window.scrollTo({ top: top, behavior: 'smooth' })
} else {
return window.scrollTo(0, top)
}
}
return window.scrollTo(0, top)
}
}
}