-
Notifications
You must be signed in to change notification settings - Fork 0
/
nuxt.config.js
executable file
·56 lines (53 loc) · 1.18 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
import path from 'path'
import glob from 'glob'
import head from './config/head'
import { modules, modulesSettings } from './config/modules'
import plugins from './config/plugins'
import build from './config/build'
import css from './config/css'
import { routeMap, otherRoutes } from './config/generate'
export default {
target: 'static',
/*
** Customize the progress-bar color
*/
loading: { color: '#fff' },
/*
** Headers of the page
*/
head: head,
generate: {
routes: otherRoutes.concat(getDynamicPaths(routeMap))
},
/*
** Global CSS
*/
css: css,
/*
** Plugins to load before mounting the App
*/
plugins: plugins,
/*
** Nuxt.js modules
*/
modules: modules,
...modulesSettings,
/*
** Build configuration
*/
build: build
}
/**
* Create an array of URLs from a list of files
* @param {*} urlFilepathTable
*/
function getDynamicPaths(urlFilepathTable) {
return [].concat(
...Object.keys(urlFilepathTable).map((url) => {
const filepathGlob = urlFilepathTable[url]
return glob.sync(filepathGlob, { cwd: 'content' }).map((filepath) => {
return `${url}/${path.basename(filepath, '.md')}`
})
})
)
}