forked from uswds/uswds
-
Notifications
You must be signed in to change notification settings - Fork 0
/
fractal.js
61 lines (52 loc) · 1.25 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
55
56
57
58
59
60
61
'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 Standards');
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 docs = fractal.docs;
docs.set('path', 'docs');
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',
],
}));
web.set('static.path', 'dist');
web.set('static.mount', 'dist');
// output files to /build
web.set('builder.dest', 'build');
module.exports = fractal;