1 | "use strict";
|
2 | const pkg = require("./package.json");
|
3 | const path = require("path");
|
4 | const fractal = require("@frctl/fractal").create();
|
5 |
|
6 | const context = {
|
7 | package: {
|
8 | name: pkg.name,
|
9 | version: pkg.version
|
10 | },
|
11 | uswds: {
|
12 | path: "../../dist"
|
13 | }
|
14 | };
|
15 |
|
16 | fractal.set("project.title", `U.S. Web Design System (v${pkg.version})`);
|
17 |
|
18 | const components = fractal.components;
|
19 | components.set("ext", ".njk");
|
20 | components.set("path", "src/components");
|
21 | components.set("default.preview", "@uswds");
|
22 | components.set("default.context", context);
|
23 |
|
24 |
|
25 | components.engine(
|
26 | require("@frctl/nunjucks")({
|
27 | filters: {
|
28 | jsonify: d => JSON.stringify(d, null, " "),
|
29 | dataurl: (d, type) => `data:${type},${encodeURIComponent(d)}`
|
30 | },
|
31 | paths: ["src/components"]
|
32 | })
|
33 | );
|
34 |
|
35 | const web = fractal.web;
|
36 |
|
37 | web.theme(
|
38 | require("@frctl/mandelbrot")({
|
39 | lang: "en-US",
|
40 | skin: "white",
|
41 |
|
42 | format: "yaml",
|
43 |
|
44 | panels: ["html", "notes", "view", "context", "resources", "info"]
|
45 | })
|
46 | );
|
47 |
|
48 | web.set("static.path", "dist");
|
49 | web.set("static.mount", "dist");
|
50 |
|
51 | web.set("builder.dest", "build");
|
52 |
|
53 | module.exports = fractal;
|