-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnuxt.config.js
executable file
·110 lines (95 loc) · 3.41 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
import meta from './site/assets/meta'
module.exports = {
srcDir: './site',
// rootDir: path.resolve(__dirname, '..'),
generate: {
dir: 'docs'
},
router: {
base: process.env.NODE_ENV === 'development' ? '/' : '/setka/',
scrollBehavior: function (to, from, savedPosition) {
// if the returned position is falsy or an empty object,
// will retain current scroll position.
let position = false
if (to.hash && to.path === from.path && document.querySelector(to.hash)) {
position = { selector: to.hash }
return position
}
// if no children detected
if (to.matched.length < 2) {
// scroll to the top of the page
position = { x: 0, y: 0 }
} 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 }
}
// savedPosition is only available for popstate navigations (back button)
if (savedPosition) {
position = savedPosition
}
return new Promise(resolve => {
// wait for the out transition to complete (if necessary)
window.$nuxt.$once('triggerScroll', () => {
// coords will be used if no selector is provided,
// or if the selector didn't match any element.
if (to.hash && document.querySelector(to.hash)) {
// scroll to anchor by returning the selector
// position = { selector: to.hash }
position = false
setTimeout(() => {
document.querySelector(to.hash).scrollIntoView()
}, 100)
}
resolve(position)
})
})
}
},
/*
** Headers of the page
*/
head: {
title: 'Setka CSS Library',
titleTemplate: '%s · Setka',
meta: [
{ charset: 'utf-8' },
{ name: 'viewport', content: 'width=device-width, initial-scale=1, shrink-to-fit=no' },
...meta({
'description': 'Easily control website\'s layout, vertical rythm, responsivness',
'keywords': 'css, css library, layout, responsive, mobile first, bootstrap, stylus, grid, baseline grid',
"og:title": 'Setka CSS library',
"og:type": 'website',
// "og:url": data.url,
"og:image": 'setka-css-share.png',
"og:description": 'Easily control website\'s layout, vertical rythm, responsivness',
})
],
link: [
{ rel: 'icon', type: 'image/x-icon', href: 'favicon.ico' }
]
},
/*
** Global CSS
*/
css: [
{ src: '~/assets/typography.styl', lang: 'stylus' },
{ src: 'highlight.js/styles/github.css' }
],
/*
** Customize the progress-bar color
*/
loading: false,
transition: false,
modules: [
'~/modules/generate-after'
],
buildModules: [
'@nuxtjs/style-resources',
],
styleResources: {
stylus: ['~~/lib/setka/index.styl']
},
plugins: [
{ src: '~/plugins/toc', ssr: false}
]
}