-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfractal.config.js
107 lines (99 loc) · 2.75 KB
/
fractal.config.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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
'use strict';
const mandelbrot = require('@frctl/mandelbrot');
const fractal = require('@frctl/fractal').create();
// Get base theme
const themeConfig = require('./fractal.theme.js');
const theme = mandelbrot(themeConfig);
// Configure UI
fractal.set('project.title', 'TACC UI Pattern Library');
fractal.components.set('label', 'Patterns');
fractal.components.set('title', 'Patterns');
fractal.components.set('default.status', 'wip');
fractal.components.set('statuses', {
prototype: {
label: "Prototype",
description: "Do not implement.",
color: "#666666"
},
wip: {
label: "Work in Progress",
description: "Work in progress. Implement with caution.",
color: "#999933"
},
backup: {
label: "Backup",
description: "If regular variations fail.",
color: "#996633"
},
ready: {
label: "Ready",
description: "Ready to implement.",
color: "#339966"
},
deprecated: {
label: 'Deprecated',
description: 'Do not implement.',
color: '#800000'
}
});
// Set source paths
// (for components)
fractal.components.set('path', __dirname + '/src/lib/_imports');
fractal.components.set('resources', {
// Render assets from component folders in a panel
// WARNING: Undocumented feature
// https://github.com/frctl/fractal/issues/150#issuecomment-254642411
// https://github.com/frctl/fractal/issues/93#issuecomment-236429871
assets: {
label: 'Assets',
match: ['**/*.css', '**/*.js'],
},
});
fractal.components.set('default.context', {
shouldSkipPattern: true, // true, because core-styles.….css loads most
globalStyles: [{
isInternal: true,
layer: 'base',
path: '/assets/core-styles.demo.css'
},{
isInternal: true,
layer: 'base',
path: '/assets/core-styles.base.css'
}],
cmsStyles: [{
isInternal: true,
layer: 'base',
path: '/assets/core-styles.cms.css'
}],
docsStyles: [{
isInternal: true,
layer: 'base',
path: '/assets/core-styles.docs.css'
}],
portalStyles: [{
isInternal: true,
layer: 'base',
path: '/assets/core-styles.portal.css'
}]
});
// Set website paths
fractal.docs.set('path', __dirname + '/docs');
fractal.web.set('static.path', __dirname + '/dist');
fractal.web.set('static.mount', 'assets');
fractal.web.set('builder.dest', __dirname + '/demo');
// Customize theme
fractal.web.theme(theme);
// Add template helpers
const engine = fractal.components.engine();
engine.handlebars.registerHelper('eq', function(a, b) {
return a == b;
});
engine.handlebars.registerHelper('has', function(array, item) {
return array.includes(item);
});
engine.handlebars.registerHelper('ifno', function(value, fallback) {
const output = value || fallback;
return new engine.handlebars.SafeString(output);
});
// Export
module.exports = fractal;