-
Notifications
You must be signed in to change notification settings - Fork 0
/
gatsby-config.js
46 lines (43 loc) · 944 Bytes
/
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
const fs = require("fs")
require("dotenv").config({
path:
(fs.existsSync(`.env.${process.env.NODE_ENV}`) &&
`.env.${process.env.NODE_ENV}`) ||
".env",
})
const path = require("path")
module.exports = (options) => {
options.fonts = options.fonts || []
const mergedOptions = {
...options,
}
const plugins = [
`gatsby-plugin-react-helmet`,
`gatsby-plugin-sass`,
{
resolve: "@gatsbywpthemes/gatsby-plugin-wp-seo",
},
]
/**
* Conditionally add google fonts plugin
* to avoid errors on build
*/
if (
options.webfontsOptions.fonts &&
(options.webfontsOptions.fonts.google ||
options.webfontsOptions.fonts.google2)
) {
plugins.push({
resolve: `gatsby-plugin-webfonts`,
options: {
formats: ["woff2", "woff"],
useMinify: true,
display: "swap",
...options.webfontsOptions,
},
})
}
return {
plugins,
}
}