-
Notifications
You must be signed in to change notification settings - Fork 4
/
fractal.config.js
63 lines (52 loc) · 1.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
'use strict';
const paths = {
// HTML build destination : Fractal 'builder' deployment for Surge publication
pub: `${__dirname}/www`,
// local development build destination : Fractal 'static' deployment
static: `${__dirname}/build`,
// local source files
src: `${__dirname}/src`,
components: `${__dirname}/src/components`,
docs: `${__dirname}/src/docs`
};
const buildDir = 'build';
// Required modules
const fractal = module.exports = require('@frctl/fractal').create();
// Project config.
fractal.set('project.title', 'V&A Front-end Components');
fractal.set('project.buildDir', buildDir);
// Component config.
fractal.components.set('path', paths.components);
fractal.components.set('default.status', null);
fractal.components.set('default.preview', '@preview');
fractal.components.set('ext', '.html');
// Documentation pages
fractal.docs.set('ext', '.md');
fractal.docs.set('path', paths.docs);
// Web UI config.
fractal.web.set('server.port', 8000);
fractal.web.set('server.sync', true);
// Local development environment
fractal.web.set('static.path', paths.static);
fractal.web.set('static.mount', 'build');
// Distribution environment
fractal.web.set('builder.dest', paths.pub);
fractal.web.set('builder.urls.ext', null);
// Templating config.
const nunjucks = require('@frctl/nunjucks')({
filters: {
markdown(str) {
return md.render(str);
},
markdownInline(str) {
return md.renderInline(str);
},
slugify(str) {
return str.toLowerCase().replace(/[^\w]+/g, '');
},
stringify() {
return JSON.stringify(this, null, '\t');
}
}
});
fractal.components.engine(nunjucks);