-
Notifications
You must be signed in to change notification settings - Fork 0
/
gatsby-config.js
137 lines (130 loc) · 4.2 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
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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
const path = require(`path`)
let siteConfig
let ghostConfig
let mediaConfig
let routesConfig
try {
siteConfig = require(`./siteConfig`)
} catch (e) {
siteConfig = null
}
try {
mediaConfig = require(`./mediaConfig`)
} catch (e) {
mediaConfig = null
}
try {
routesConfig = require(`./routesConfig`)
} catch (e) {
routesConfig = null
}
try {
ghostConfig = require(`./.ghost`)
} catch (e) {
ghostConfig = {
development: {
apiUrl: process.env.GHOST_API_URL,
contentApiKey: process.env.GHOST_CONTENT_API_KEY,
},
production: {
apiUrl: process.env.GHOST_API_URL,
contentApiKey: process.env.GHOST_CONTENT_API_KEY,
},
}
} finally {
const { apiUrl, contentApiKey } = process.env.NODE_ENV === `development` ? ghostConfig.development : ghostConfig.production
if (!apiUrl || !contentApiKey || contentApiKey.match(/<key>/)) {
ghostConfig = null //allow default config to take over
}
}
module.exports = {
plugins: [
{
resolve: `gatsby-plugin-google-analytics`,
options: {
trackingId: "UA-180979375-1",
// Defines where to place the tracking script - `true` in the head and `false` in the body
head: true,
}
},
`gatsby-plugin-preact`,
`gatsby-plugin-netlify`,
{
resolve: `gatsby-source-filesystem`,
options: {
path: path.join(__dirname, `src`, `images`),
name: `images`,
},
},
{
resolve: `gatsby-theme-try-ghost`,
options: {
ghostConfig: ghostConfig,
siteConfig: siteConfig,
mediaConfig: mediaConfig,
routes: routesConfig,
},
},
{
resolve: `gatsby-theme-ghost-dark-mode`,
options: {
// Set to true if you want your theme to default to dark mode (default: false)
// Note that this setting has an effect only, if
// 1. The user has not changed the dark mode
// 2. Dark mode is not reported from OS
defaultModeDark: false,
// If you want the defaultModeDark setting to take precedence
// over the mode reported from OS, set this to true (default: false)
overrideOS: false,
},
},
{
resolve: `gatsby-plugin-sharp`,
},
{
resolve: `gatsby-transformer-rehype`,
options: {
filter: node => (
// this is an example (any node type can be selected)
node.internal.type === `GhostPost`
),
plugins: [
{
resolve: `gatsby-rehype-inline-images`,
// all options are optional and can be omitted
options: {
// all images larger are scaled down to maxWidth (default: maxWidth = imageWidth)
// maxWidth: 2000,
withWebp: true,
// disable, if you need to save memory
useImageCache: true,
}
},
],
},
},
{
resolve: `gatsby-theme-ghost-members`,
},
{
resolve: `gatsby-transformer-rehype`,
options: {
filter: node => (
node.internal.type === `GhostPost` ||
node.internal.type === `GhostPage`
),
plugins: [
{
resolve: `gatsby-rehype-ghost-links`,
},
{
resolve: `gatsby-rehype-prismjs`,
},
],
},
},
// this (optional) plugin enables Progressive Web App + Offline functionality
// This plugin is currently causing issues: https://github.com/gatsbyjs/gatsby/issues/25360
`gatsby-plugin-offline`,
],
}