-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.js
46 lines (42 loc) · 1.16 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
'use strict'
const metalsmith = require('metalsmith'),
ifThen = require('metalsmith-if'),
argv = require('optimist').argv,
ghpages = require('gh-pages'),
path = require('path'),
metadata = require('./config/metadata'),
sass = require('./config/sass'),
collections = require('./config/collections'),
excerpts = require('metalsmith-excerpts'),
// tags = require('./config/tags'),
layouts = require('./config/layouts'),
permalinks = require('./config/permalinks'),
markdown = require('./config/markdown'),
browsersync = require('./config/browsersync'),
drafts = require('metalsmith-drafts')
metalsmith(__dirname)
.source('src')
.use(metadata)
.use(sass)
.use(markdown)
.use(drafts())
.use(collections)
.use(excerpts())
// .use(tags)
.use(permalinks)
.use(layouts)
.use(ifThen(
argv.watch,
browsersync
))
.destination('dist')
.build(err => {
if (err) throw err
if (argv.build)
ghpages.publish(path.join(__dirname, 'dist'), {
message: 'chore(dist): auto-publish on Github pages'
}, err => {
if (err) throw err
console.log('Website is published on GH pages branch!')
})
})