-
Notifications
You must be signed in to change notification settings - Fork 10
/
fractal.config.js
85 lines (72 loc) · 2.25 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
'use strict'
const fractal = module.exports = require('@frctl/fractal').create()
const fractalTwig = require('@frctl/twig')
const fs = require('fs')
const mandelbrot = require('@frctl/mandelbrot')
const resolve = require('path').resolve
const theme = require('fractal-theme-hydrogen')(mandelbrot)
/**
* Use vite-manifest to provide the twig function viteManifest for referencing
* assets compiled by vite.
*/
import('vite-manifest').then(({ default: viteManifest }) => {
const config = {}
const path = resolve('./web/dist/manifest.json')
if (fs.existsSync(path)) {
viteManifest = viteManifest(path)
config.functions = { viteManifest }
}
fractal.components.engine(fractalTwig(config))
})
/**
* Name your Pattern Library!
*/
fractal.set('project.title', 'Pattern Library')
/**
* Use Twig instead of Handlebars.
*/
fractal.components.set('ext', '.twig')
/**
* Use Hydrogen, a cleaner Fractal theme.
*/
fractal.web.theme(theme)
/**
* An additional status for deprecated components.
*/
fractal.components.set('statuses.deprecated', {
label: 'Deprecated',
description: 'May be removed in a future version.',
color: '#874',
})
/**
* Components are in /resources/styles.
*/
fractal.components.set('path', resolve('./resources/styles'))
/**
* Docs are in /resources/styles/docs.
*/
fractal.docs.set('path', resolve('./resources/styles/docs'))
/**
* Build the pattern library (`fractal build`) in /web/pattern-library.
*/
fractal.web.set('builder.dest', resolve('./web/pattern-library'))
/**
* Static files the pattern library uses are copied from /web, but make sure
* not to copy index.php or the pattern library itself.
*/
fractal.web.set('static.path', resolve('./web'))
fractal.web.set('builder.static.ignored', [
resolve('./web/pattern-library'),
resolve('./web/index.php'),
])
/**
* Use BrowserSync when you run `fractal start`. Don't rebuild when .scss files
* change; wait until the CSS changes.
*/
fractal.web.set('server.sync', true)
fractal.web.set('server.syncOptions', { watchOptions: { ignored: /\.scss$/i } });
/**
* Instead of using BrowserSync above, you can use server.watch as a
* lightweight server that will rebuild on changes but won't hot reload.
*/
// fractal.web.set('server.watch', true)