forked from nice-digital/nice-design-system
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.sassdoc-nice-theme.js
63 lines (53 loc) · 1.28 KB
/
.sassdoc-nice-theme.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
/**
* SassDoc filters (providing Markdown and other helpers).
*
* See <https://github.com/SassDoc/sassdoc-filter>.
*/
//var filter = require("sassdoc-filter");
/**
* SassDoc indexer module, to index data with a certain granularity.
*
* See <https://github.com/SassDoc/sassdoc-indexer>.
*/
//var indexer = require("sassdoc-indexer");
/**
* Utility function we will use to merge a default configuration
* with the user object.
*/
var extend = require("extend");
var sassdocExtras = require("sassdoc-extras");
var path = require("path");
var fs = require("fs");
var def = JSON.parse(fs.readFileSync(".sassdocrc", "utf8"));
const applyDefaults = ctx =>
extend({}, def, ctx, {
groups: extend(def.groups, ctx.groups),
display: extend(def.display, ctx.display)
});
module.exports = function(dest, ctx) {
ctx = applyDefaults(ctx);
sassdocExtras(
ctx,
"description",
"markdown",
"display",
"groupName",
"shortcutIcon",
"sort",
"resolveVariables"
);
ctx.data = {
display: ctx.display,
items: ctx.data,
groups: ctx.groups,
byGroupAndType: sassdocExtras.byGroupAndType(ctx.data)
};
fs.writeFileSync(
path.join(dest, "nice-design-system.json"),
JSON.stringify(ctx.data, null, 2),
"utf-8"
);
return new Promise(function(resolve, reject) {
resolve();
});
};