-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.js
45 lines (37 loc) · 943 Bytes
/
main.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
// main.js
import Metalsmith from 'metalsmith';
import babel from 'metalsmith-babel';
import collections from 'metalsmith-collections';
import layouts from 'metalsmith-layouts';
import markdown from 'metalsmith-markdown';
import permalinks from 'metalsmith-permalinks';
import sass from 'metalsmith-sass';
import debug from 'metalsmith-debug';
import discoverPartials from 'metalsmith-discover-partials';
const production = process.env.NODE_ENV === 'production';
Metalsmith(__dirname)
.source('./source')
.destination('./dist')
.clean(true)
.metadata({
production,
})
.use(markdown())
.use(collections({
blog: {
sortBy: 'date',
reverse: true,
},
}))
.use(permalinks({ relative: false }))
.use(discoverPartials({
directory: 'layouts/partials',
pattern: /\.hbs$/,
}))
.use(layouts())
.use(sass())
.use(babel())
.use(debug())
.build((err) => {
if (err) throw err;
});