-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.js
38 lines (37 loc) · 846 Bytes
/
build.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
var metalsmith = require('metalsmith');
var markdown = require('metalsmith-markdown');
var layouts = require('metalsmith-layouts');
var collections = require('metalsmith-collections');
metalsmith(__dirname)
.source('./_source')
.destination('.')
.clean(false)
.use(function (files) {
for (var f in files) {
var sep = f.split("\\");
var arr = [];
arr.length = sep.length;
var root = arr.join("../");
files[f].root = root;
}
})
.use(collections({
routes: {
sortBy: 'date',
reverse: true
}
}))
.use(markdown())
.use(layouts({
engine: 'handlebars',
directory: '_layouts',
partials: '_partials'
}))
.use(function (files) {
for (var f in files) {
console.log(f);
}
})
.build(function (err) {
if (err) throw err;
});