-
Notifications
You must be signed in to change notification settings - Fork 2
/
nuxt.config.js
46 lines (42 loc) · 864 Bytes
/
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
const fs = require('fs');
module.exports = {
build: {
loaders: [
{
test: /\.md$/,
loaders: [
'json-loader',
'front-matter-loader',
],
},
],
vendor: ['marked','highlight.js'],
},
css: [
'highlight.js/styles/github.css',
],
generate: {
dir: 'dist',
routes: function (callback) {
fs.readFile('./static/api/posts.json', function (err, data) {
if (err) {
callback(err);
return;
}
if (!data) {
callback('no post data');
return;
}
const posts = JSON.parse(data);
const routes =
posts.map(function (post) {
return '/posts/' + post.slug;
});
callback(null, routes);
});
},
},
router: {
base: process.env.BASE_URL || '/'
}
};