-
Notifications
You must be signed in to change notification settings - Fork 1
/
fractal.config.js
127 lines (119 loc) · 3.62 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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
const { resolve } = require('path');
module.exports = {
/*
* Project title used in the UI
*/
title: 'Nunjucks Demo',
/*
* Template engine adapter
*
* Adapters are responsible for implementing component
* rendering but can also hook into the component compilation
* and UI preview rendering steps if required.
*/
adapter: require('@frctl/fractalite-adapter-nunjucks')({
// Adapter options here...
}),
/*
* Basic theme tweaks can be done via config here.
* The `vars` object is a set of CSS variable overrides
* that will be applied to the UI.
*/
theme: {
vars: {
'link-color': '#0074d9'
}
},
/*
* Absolute path to the components directory.
*
* This can also be an array of directory paths and
* can use glob syntax with negation to exclude certain
* files from the compiler.
*
* `node_modules` directories within the components directory
* are always ignored.
*/
components: resolve(__dirname, './src/components'),
/*
* Absolute path to the pages directory, if required.
*
* Pages are markdown documents that can additionally be
* run through a Nunjucks renderer to give dynamic access
* to component information.
*/
pages: resolve(__dirname, './pages'),
nav: {
/*
* Optional navigation generator.
*
* If not provided the default navigation structure will be used.
*
* The value of the items property can either be an array of navigation
* items or a function that returns an array of items. The function will
* be called with a set of entities (such as components and pages) as well
* as a toTree utility function for converting flat arrays of entities to
* nav tree structures.
*
* Each item in the tree can have the following properties:
*
* - `label`: The text displayed for the nav item
* - `url`: the URL to link to (if not a directory)
* - `children`: An array of child navigation items
*/
items({ components, pages }, toTree) {
return [
toTree(pages),
{
label: 'Components',
children: toTree(components),
expanded: true // open by default
},
{
label: 'External links',
expanded: true,
children: [
{
label: 'Github repo →',
url: 'http://github.com/frctl/fractalite'
}
]
}
];
}
},
/*
* Project plugins registry
*
* Plugins have full access to both the core component compiler
* and the UI generator.
*
* A plugin is just a function that receives the main application
* object. Most plugins will additionally wrap this function in another
* that can accept options for user customisation.
*/
plugins: [
/*
* The asset bundler plugin uses Parcel for zero-config
* asset bundling and hot module reloading.
* It also automatically serves bundled assets and
* adds them to component previews.
*
* Whilst sufficient for most projects, those with more complex
* asset build requirements may choose to use their own asset
* bundler/development workflow.
*/
require('@frctl/fractalite-plugin-assets-bundler')({
entryFile: resolve(__dirname, './src/assets/preview.js'),
outFile: resolve(__dirname, './dist/assets/build.js')
}),
/*
* The notes plugin allows component notes to be
* specified in component config files and/or (optionally)
* read from a markdown file in the component directory.
*/
require('@frctl/fractalite-plugin-notes')({
notesFile: 'notes.md'
})
]
};