forked from GPII/docs-first-discovery
-
Notifications
You must be signed in to change notification settings - Fork 1
/
docpad.js
93 lines (84 loc) · 3.04 KB
/
docpad.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
/*
Copyright 2015 OCAD University
Licensed under the Educational Community License (ECL), Version 2.0 or the New
BSD license. You may not use this file except in compliance with one these
Licenses.
You may obtain a copy of the ECL 2.0 License and BSD License at
https://github.com/fluid-project/infusion/raw/master/Infusion-LICENSE.txt
*/
// This project's repository on GitHub. Used to build URLs for "Edit on GitHub" links
// Change this value to match your site.
var githubDocRoot = "https://github.com/GPII/docs-first-discovery/blob/master/src/documents/";
var path = require("path");
var fs = require("fs");
var docsCore = require("docs-core");
var siteStructure = JSON.parse(fs.readFileSync("site-structure.json"));
var selectorsIntro = fs.readFileSync("src/partials/selectors-intro.md", "utf8");
// We locate the images within the src/documents directory so that images can
// be viewed on GitHub, as well as in the DocPad output. We need to
// instruct DocPad to treat the images specially so that they are not
// processed. We tell DocPad to ignore the images using "ignorePaths" and we
// then copy them ourselves with a "writeAfter" event handler.
var rootPath = process.cwd();
var imagesSrcDir = path.join(rootPath, "src", "documents", "images");
var imagesDestDir = "out/images";
module.exports = {
rootPath: rootPath,
filesPaths: [
docsCore.getStaticFilesDir(),
"static"
],
ignorePaths: [ imagesSrcDir ],
renderSingleExtensions: true,
templateData: {
siteStructure: siteStructure
},
plugins: {
handlebars: {
helpers: {
rewriteMdLinks: docsCore.helpers.rewriteMdLinks,
getGithubLocation: docsCore.helpers.makeGithubLocationHelper(githubDocRoot),
getRelativeUrl: docsCore.helpers.getRelativeUrl,
ifEqual: docsCore.helpers.ifEqual
},
partials: {
selectorsIntro: selectorsIntro
}
},
highlightjs: {
aliases: {
stylus: "css"
}
},
stylus: {
stylusLibraries: {
nib: true
},
stylusOptions: {
compress: true,
'include css': true
}
},
uglify: {
// Disable UglifyJS on the development environment.
environments: {
development: {
enabled: false
}
},
// Pass false to skip compressing entirely. Pass an object to specify custom
// compressor options: http://lisperator.net/uglifyjs/compress .
compress: {},
// Pass false to skip mangling names.
mangle: {}
}
},
environments: {
development: {
stylusOptions: {
// Disable compression on the development environment
compress: false
}
}
}
};