UNPKG

1.23 kBJavaScriptView Raw
1"use strict";
2const pkg = require("./package.json");
3const path = require("path");
4const fractal = require("@frctl/fractal").create();
5
6const context = {
7 package: {
8 name: pkg.name,
9 version: pkg.version
10 },
11 uswds: {
12 path: "../../dist"
13 }
14};
15
16fractal.set("project.title", `U.S. Web Design System (v${pkg.version})`);
17
18const components = fractal.components;
19components.set("ext", ".njk");
20components.set("path", "src/components");
21components.set("default.preview", "@uswds");
22components.set("default.context", context);
23
24// use Nunjucks as the templating engine
25components.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
35const web = fractal.web;
36
37web.theme(
38 require("@frctl/mandelbrot")({
39 lang: "en-US",
40 skin: "white",
41 // display context data in YAML
42 format: "yaml",
43 // which panels to show
44 panels: ["html", "notes", "view", "context", "resources", "info"]
45 })
46);
47
48web.set("static.path", "dist");
49web.set("static.mount", "dist");
50// output files to /build
51web.set("builder.dest", "build");
52
53module.exports = fractal;