forked from opencollective/opencollective-frontend
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstyleguide.config.js
109 lines (105 loc) · 2.94 KB
/
styleguide.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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
const fs = require('fs');
const path = require('path');
// eslint-disable-next-line node/no-unpublished-require
const fileExistsCaseInsensitive = require('react-styleguidist/lib/scripts/utils/findFileCaseInsensitive');
module.exports = {
assetsDir: 'styleguide',
require: [path.join(__dirname, 'static/styles/app.css')],
getExampleFilename(componentPath) {
const parsedPath = path.parse(componentPath);
const parentDirName = parsedPath.dir.split('components/')[1] || '';
const parentDirPath = path.join(__dirname, 'styleguide', 'examples', parentDirName);
if (!fs.existsSync(parentDirPath)) {
return false;
}
const examplePath = path.join(parentDirPath, `${parsedPath.name}.md`);
return fileExistsCaseInsensitive(examplePath) || false;
},
pagePerSection: true,
moduleAliases: {
components: path.resolve(__dirname, 'components'),
},
sections: [
{
name: 'Atoms',
components: 'components/Styled*.js',
description: 'Base design atoms.',
},
{
name: 'UI',
content: 'styleguide/pages/UI.md',
components: 'components/*.js',
ignore: ['components/Contribute*.js', 'components/Styled*.js', 'components/collective-page/*.js'],
},
{
name: 'FAQs',
components: 'components/faqs/*.js',
description: 'FAQs.',
},
{
name: 'Collective Page',
components: 'components/collective-page/*.js',
description: 'These components are used on the donate/contribute flow.',
},
{
name: 'Contribution Flow',
components: 'components/contribution-flow/*.js',
description: 'These components are used on the donate/contribute flow.',
},
{
name: 'Grid',
content: 'styleguide/pages/Grid.md',
sections: [
{
name: 'Box',
content: 'styleguide/examples/Box.md',
},
{
name: 'Flex',
content: 'styleguide/examples/Flex.md',
},
],
},
],
skipComponentsWithoutExample: true,
styleguideComponents: {
Wrapper: path.join(__dirname, 'styleguide/Wrapper'),
},
styles: {
Blockquote: {
blockquote: {
borderLeft: '3px solid grey',
margin: '16px 0',
padding: '0 32px',
},
},
},
title: 'Open Collective Frontend Style Guide',
usageMode: 'expand',
webpackConfig: {
resolve: { extensions: ['.js', '.json'] },
stats: { children: false, chunks: false, modules: false, reasons: false },
module: {
rules: [
{
test: /\.(js|jsx)$/,
exclude: /node_modules/,
use: [{ loader: 'babel-loader', options: { cacheDirectory: true } }],
},
{
test: /components\/.*\.(svg)$/,
use: {
loader: 'url-loader',
options: {
limit: 1000000,
},
},
},
{
test: /\.(css)$/,
use: ['style-loader', 'css-loader'],
},
],
},
},
};