-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathbuild.js
127 lines (123 loc) · 3.27 KB
/
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
var metalsmith = require('metalsmith'),
autoprefixer = require('metalsmith-autoprefixer'),
branch = require('metalsmith-branch'),
collections = require('metalsmith-collections'),
excerpts = require('metalsmith-excerpts'),
feed = require('metalsmith-feed'),
gravatar = require('metalsmith-gravatar'),
less = require('metalsmith-less'),
lunr = require('metalsmith-lunr'),
markdown = require('metalsmith-markdown'),
metallic = require('metalsmith-metallic'),
paginate = require('metalsmith-pagination'),
permalinks = require('metalsmith-permalinks'),
publish = require('metalsmith-publish'),
serve = require('metalsmith-serve'),
tags = require('metalsmith-tags'),
templates = require('metalsmith-templates'),
watch = require('metalsmith-watch'),
wordcount = require('metalsmith-word-count');
var config;
try {
config = require('./config.json');
} catch(e) {
config = {
"url":"http://localhost:8080",
"title": "my website",
"gravatarEmail": "asdf@asdf.com"
};
}
metalsmith(__dirname)
.metadata({
site:{
title: config.title,
url: config.url
}
})
.source('./bower_components')
.destination('./build/lib')
.build(function(err) {
if (err) {
console.log(err);
}
else {
console.log('Bower build complete!');
}
});
metalsmith(__dirname)
.metadata({
site:{
title: config.title,
url: config.url
}
})
.source('./src')
.destination('./build')
.use(publish({draft: false, private: false, future: false, futureMeta: 'date'}))
.use(metallic())
.use(markdown())
.use(gravatar({myGravatar: config.gravatarEmail}))
.use(excerpts())
.use(collections({
posts: {
pattern: 'posts/**.html',
sortBy: 'date',
reverse: true
}
}))
.use(branch('posts/**.html')
.use(permalinks({
pattern: 'posts/:title',
relative: false
}))
)
.use(branch('!posts/**.html')
.use(branch('!index.md').use(permalinks({
relative: false
})))
)
//.use(tags({
// handle: 'tags',
// path: 'content/posts',
// template: '/templates/tag.jade',
// sortBy: 'date',
// reverse: true
//}))
//.use(paginate({
// 'collections.posts': {
// perPage: 1,
// template: 'posts.jade',
// first: 'posts/index.html',
// path: 'posts/page/:num/index.html',
// pageMetadata: {
// title: 'Archive'
// }
//}}))
.use(wordcount({
metaKeyCount: "wordCount",
metaKeyReadingTime: "readingTime",
speed: 300,
seconds: false,
raw: false
}))
.use(templates('jade'))
.use(feed({collection: 'posts'}))
.use(less())
.use(autoprefixer())
//.use(lunr(/*todo options*/))
.use(serve({
port: 8080,
verbose: true
}))
.use(watch({
pattern : '**/*',
livereload: true
}))
.build(function(err) {
if (err) {
console.log(err);
}
else {
console.log('Site build complete!');
}
});