-
Notifications
You must be signed in to change notification settings - Fork 2
/
fractal.js
54 lines (46 loc) · 1.22 KB
/
fractal.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
"use strict";
const pkg = require("./package.json");
const path = require("path");
const fractal = require("@frctl/fractal").create();
const context = {
package: {
name: pkg.name,
version: pkg.version
},
uswds: {
path: "../../dist"
}
};
fractal.set("project.title", `U.S. Web Design System (v${pkg.version})`);
const components = fractal.components;
components.set("ext", ".njk");
components.set("path", "src/components");
components.set("default.preview", "@uswds");
components.set("default.context", context);
// use Nunjucks as the templating engine
components.engine(
require("@frctl/nunjucks")({
filters: {
jsonify: d => JSON.stringify(d, null, " "),
dataurl: (d, type) => `data:${type},${encodeURIComponent(d)}`
},
paths: ["src/components"]
})
);
const web = fractal.web;
web.theme(
require("@frctl/mandelbrot")({
lang: "en-US",
skin: "white",
// display context data in YAML
format: "yaml",
// which panels to show
panels: ["html", "notes", "view", "context", "resources", "info"],
scripts: []
})
);
web.set("static.path", "dist");
web.set("static.mount", "dist");
// output files to /build
web.set("builder.dest", "build");
module.exports = fractal;