forked from styleguidist/react-styleguidist
-
Notifications
You must be signed in to change notification settings - Fork 0
/
styleguide.config.js
100 lines (99 loc) · 2.52 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
const path = require('path');
module.exports = {
title: 'React Style Guide Example',
pagePerSection: true,
sections: [
{
name: 'Documentation',
content: 'docs/Documentation.md',
sections: [
{
name: 'Files',
content: 'docs/Files.md',
components: () => ['./src/components/WrappedButton/WrappedButton.js'],
sections: [
{
name: 'First File',
content: 'docs/One.md',
description: 'This is the first section description',
components: () => ['./src/components/Label/Label.js'],
},
{
name: 'Second File',
content: 'docs/Two.md',
},
],
},
{
name: 'Online documentation',
href: 'https://github.com/styleguidist/react-styleguidist',
external: true,
},
],
sectionDepth: 2,
},
{
name: 'Components',
content: 'docs/Components.md',
sections: [
{
name: 'Buttons',
components: () => [
'./src/components/Button/Button.js',
'./src/components/ThemeButton/ThemeButton.js',
],
exampleMode: 'expand', // 'hide' | 'collapse' | 'expand'
usageMode: 'hide', // 'hide' | 'collapse' | 'expand'
},
{
name: 'Fields',
components: () => ['./src/components/Placeholder/Placeholder.js'],
exampleMode: 'expand', // 'hide' | 'collapse' | 'expand'
usageMode: 'expand', // 'hide' | 'collapse' | 'expand'
},
{
name: 'Labels',
components: () => ['./src/components/MyLabel/Label.js'],
exampleMode: 'expand', // 'hide' | 'collapse' | 'expand'
usageMode: 'expand', // 'hide' | 'collapse' | 'expand'
},
{
name: 'Others',
components: () => ['./src/components/RandomButton/RandomButton.js'],
exampleMode: 'collapse', // 'hide' | 'collapse' | 'expand'
usageMode: 'collapse', // 'hide' | 'collapse' | 'expand'
},
],
sectionDepth: 0,
},
],
require: [path.join(__dirname, 'src/styles.css')],
webpackConfig: env => ({
module: {
rules: [
{
test: /\.jsx?$/,
exclude: /node_modules/,
loader: 'babel-loader',
},
{
test: /\.css$/,
loader: 'style-loader!css-loader',
},
],
},
// How to analyze what's in the bundle:
// 1. Comment `hints: 'error'` line below
// 2. Uncomment a line with `stats.json` in src/scripts/build.js
// 3. npm run build:sections
// 4. npx webpack-bundle-analyzer stats.json
performance:
env === 'development'
? false
: {
maxAssetSize: 1100000, // bytes
maxEntrypointSize: 1100000, // bytes
hints: 'error',
},
}),
};