-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfractal.js
More file actions
70 lines (56 loc) · 1.86 KB
/
fractal.js
File metadata and controls
70 lines (56 loc) · 1.86 KB
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
'use strict';
var config = require('./config')
/*
* Require the path module
*/
const path = require('path');
/*
* Require the Fractal module
*/
const fractal = module.exports = require('@frctl/fractal').create();
const mandelbrot = require('@frctl/mandelbrot'); // require the Mandelbrot theme module
// create a new instance with custom config options
const customisedTheme = mandelbrot(config.fractal.themeSettings);
if(config.fractal.templateOverride){
customisedTheme.addLoadPath(path.join(__dirname, config.root.path, config.fractal.templateOverride));
}
fractal.web.theme(customisedTheme);
/*
* Template engine
*/
if(config.fractal.templateEngine == 'nunjucks'){
// Nunjucks
const nunjucksAdapter = require('@frctl/nunjucks')(config.fractal.templateSettings);
fractal.components.engine(nunjucksAdapter);
}
else {
// Twig
const twigAdapter = require('spacecraft-twig')(config.fractal.templateSettings);
fractal.components.engine(twigAdapter);
}
fractal.components.set('ext', config.fractal.templateExtension);
/*
* Give your project a title.
*/
fractal.set('project.title', config.fractal.project.title);
/*
* Tell Fractal where to look for components.
*/
fractal.components.set('path', path.join(__dirname, config.root.path, config.fractal.path.components));
fractal.components.set('default.preview', '@master');
/*
* Tell Fractal where to look for documentation pages.
*/
fractal.docs.set('path', path.join(__dirname, config.root.path, config.fractal.path.docs));
/*
* Tell the Fractal web preview plugin where to look for static assets.
*/
fractal.web.set('static.path', path.join(__dirname, config.root.path, config.fractal.path.static));
/*
* Build destination
*/
fractal.web.set('builder.dest', path.join(__dirname, config.root.path, config.root.production));
/*
* Sync options
*/
fractal.web.set('server.syncOptions', config.fractal.syncOptions);