forked from svanderbleek/developer-pages
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.js
48 lines (41 loc) · 1.25 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
var Metalsmith = require('metalsmith');
var templates = require('metalsmith-templates');
var markdown = require('metalsmith-markdown');
var pkg = require("./package.json");
var highlight = require('highlight').Highlight;
var sass = require('metalsmith-sass');
function addGlobalMetaData(files, metalsmith, done) {
var metadata = metalsmith.metadata();
// Uses this for versioning the SDK (for now)
metadata.version = pkg.version;
done();
}
// Set up our metalsmith, and configure cwd
var metalsmith = new Metalsmith(__dirname);
// Set up all sources to pull from, and where to dump everything
metalsmith
.source("./files")
.destination("./public");
// .path is not chainable, so these need to be on separate lines
metalsmith.path("./assets")
metalsmith.path("./templates");
// Configure the build steps, these are in order of execution
metalsmith
.use(addGlobalMetaData)
.use(markdown({
gfm: true,
highlight: function (code) {
return highlight(code);
}
}))
.use(templates({
engine: 'handlebars'
}))
.use(sass({
outputStyle: "compressed",
outputDir: "css/"
}));
// And finally build everything
metalsmith.build(function (err) {
if (err) throw err;
});