-
Notifications
You must be signed in to change notification settings - Fork 2
/
fractal.config.js
44 lines (34 loc) · 1.19 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
'use strict';
/*
* Required modules
*/
const fs = require( "fs" );
const path = require( "path" );
/* Create a new Fractal instance and export it for use elsewhere if required */
const fractal = module.exports = require('@frctl/fractal').create();
/* Set the title of the project */
fractal.set('project.title', 'DSWR Component Library');
/* Tell Fractal where the components will live */
fractal.components.set('path', __dirname + '/src/patterns');
/* Tell the Fractal web preview plugin where to look for static assets. */
fractal.web.set( "static.path", path.join( __dirname, "/src/public" ) );
/* Tell Fractal where the documentation pages will live */
fractal.docs.set('path', __dirname + '/src/docs');
/*
* Default preview
*/
fractal.components.set( "default.preview", "@preview" );
/*
* Handlebars configuration
*/
const hbs = require( "@frctl/handlebars" )( {
helpers: {
// Custom handler: inline any file from the static assets path
inline: function( src ) {
var content = fs.readFileSync( fractal.web.get( "static.path" ) + src, "utf8" );
return content;
}
}
} );
/* set as the default template engine for components */
fractal.components.engine( hbs );