-
Notifications
You must be signed in to change notification settings - Fork 0
/
nuxt.config.js
39 lines (38 loc) · 1.22 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
var webpack = require('webpack')
module.exports = {
css: [
{ src: '~assets/common.stylus', lang: 'stylus' }
],
head: {
meta: [
{ charset: 'utf-8' },
{ name: 'viewport', content: 'width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no' }
]
},
build: {
analyze: true,
plugins: [
new webpack.ContextReplacementPlugin(
/highlight\.js\/lib\/languages$/,
new RegExp(`^./(${['javascript', 'css', 'bash', 'stylus', 'cpp'].join('|')})$`)
)
]
},
generate: {
routeParams: {
'/p/:p': function (callback) {
// auto generate dynamic router according to the static/*.md when generate static pages
var fs = require('fs')
var params
fs.readdir('./static', function (e, f) {
params = f.map((v) => {
if (/.+\.md/.test(v)) { return { p: v.substr(0, v.length - 3) } }
}).filter((v) => {
return v !== undefined
})
callback(null, params)
})
}
}
}
}