/
gatsby-config.js
75 lines (70 loc) · 1.62 KB
/
gatsby-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
const path = require('path')
const { resolver } = require('react-docgen')
const annotationResolver = require('react-docgen-annotation-resolver').default
module.exports = ({
defaultLayouts = {},
docsPath = 'docs',
componentsPath = 'src/docs',
components = {},
theme = {},
figma
} = {}) => {
const themeLayouts = {
default: require.resolve('./src/components/Layout')
}
const plugins = [
{
resolve: 'gatsby-mdx',
options: {
extensions: [".md", ".mdx"],
defaultLayouts: {
...themeLayouts,
...defaultLayouts
}
}
},
{
resolve: 'gatsby-source-filesystem',
options: {
name: 'components',
path: componentsPath
}
},
{
resolve: 'gatsby-plugin-page-creator',
options: {
name: 'docs',
path: docsPath,
ignore: ['**/\.*']
},
},
{
resolve: 'gatsby-transformer-react-docgen',
options: {
resolver: (ast, recast) => {
const { findAllExportedComponentDefinitions } = resolver
const annotatedComponents = annotationResolver(ast, recast)
const exportedComponents = findAllExportedComponentDefinitions(ast, recast)
return annotatedComponents.concat(exportedComponents)
}
}
},
{
resolve: 'gatsby-transformer-styled-system',
options: { components, theme }
}
]
if (figma) {
plugins.push({
resolve: 'gatsby-source-figma',
options: figma
})
}
return {
siteMetadata: {
title: 'Gatsby Blog',
siteUrl: 'https://gatsbyjs.org'
},
plugins
}
}