This repository has been archived by the owner on Oct 21, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 55
/
fractal.js
60 lines (44 loc) · 1.97 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
'use strict';
/* Create a new Fractal instance and export it for use elsewhere if required */
const fractal = module.exports = require('@frctl/fractal').create();
// https://www.npmjs.com/package/handlebars-helpers
const helpers = require('handlebars-helpers')();
const hbs = require('@frctl/handlebars')({helpers: helpers});
fractal.components.engine(hbs);
fractal.docs.engine(hbs);
const mandelbrot = require('@frctl/mandelbrot'); // require the Mandelbrot theme module
const staticDir = __dirname + '/src/breakdown/static';
const dist = __dirname + '/dist/styleguide/';
/* Set the title & version of the project */
const fs = require('fs');
const packageJson = JSON.parse(fs.readFileSync(__dirname + '/package.json'));
fractal.set('project.title', `${packageJson.description} v${packageJson.version}`);
fractal.set('project.version', packageJson.version);
/* Tell Fractal where the patterns will live */
fractal.components.set('path', staticDir +'/scss');
/* Tell Fractal where the documentation pages will live */
fractal.docs.set('path', staticDir +'/scss/docs');
/* Tell Fractal where the static assets live */
fractal.web.set('static.path', "temp");
/* Tell Fractal the default preview wrapper to use */
fractal.components.set('default.preview', '@preview');
/* Tell Fractcal where to build the static directory */
fractal.web.set('builder.dest', dist);
/* We refer to them as patterns instead of components */
fractal.components.set('label', 'Patterns'); // default is 'Components'
fractal.components.set('title', 'Patterns'); // default is 'Components'
/* Custom theme for the Web UI */
const mandelbrotBlack = mandelbrot({
skin: "red"
});
fractal.web.theme(mandelbrotBlack);
/* Set maximum constraints for the preview window */
fractal.components.set('default.display', {
'min-width': '320px'
});
// const instance = fractal.components.engine();
//
// instance.handlebars.registerHelper('log', function(context) {
// console.log("fractal :: log :: ",context);
// return context;
// });