-
Notifications
You must be signed in to change notification settings - Fork 36
/
gatsby-config.js
137 lines (129 loc) · 3.79 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")
module.exports = {
siteMetadata: {
title: `Mirage JS • An API mocking library for frontend developers`,
description: `Build, test and demo your JavaScript application without an API`,
author: `@miragejs`,
},
plugins: [
`gatsby-plugin-styled-components`,
{
resolve: `gatsby-plugin-netlify`,
options: {
generateMatchPathRewrites: false,
},
},
`gatsby-plugin-typescript`,
`gatsby-plugin-react-helmet`,
{
resolve: `gatsby-source-filesystem`,
options: {
name: `assets/images`,
path: `${__dirname}/src/assets/images`,
},
},
{
resolve: `gatsby-source-filesystem`,
options: {
path: `${__dirname}/src/routes`,
name: "pages",
},
},
{
resolve: `gatsby-source-filesystem`,
options: {
path: `${__dirname}/src/snippets`,
name: "snippets",
},
},
{
resolve: `gatsby-source-filesystem`,
options: {
path: `${__dirname}/src/tutorial-assets/snippets`,
name: "snippets",
},
},
`gatsby-plugin-sharp`,
`gatsby-remark-images`,
`gatsby-transformer-sharp`,
{
resolve: `gatsby-plugin-manifest`,
options: {
name: `Mirage JS`,
short_name: `Mirage JS`,
start_url: `/`,
background_color: `#1A1C1D`,
theme_color: `#1A1C1D`,
display: `standalone`,
icon: `src/assets/images/mirage-favicon.svg`,
},
},
`gatsby-plugin-postcss`,
// filters: [
// function(value) {
// if (value.tagname === "feGaussianBlur") {
// let newNode = { ...this.node }
// // Set color-interpolation-filters for Safari
// // https://stackoverflow.com/questions/24295043/svg-gaussian-blur-in-safari-unexpectedly-lightens-image
// newNode.props.colorInterpolationFilters = "sRGB"
// this.update(newNode)
// }
// },
// ],
{
resolve: "gatsby-plugin-svgr",
options: {
prettier: false,
svgo: true, // Use the .svgo.yml file to config SVGO
},
},
{
resolve: "gatsby-plugin-mdx",
options: {
extensions: [".mdx", ".md"],
remarkPlugins: [require("remark-slug")],
gatsbyRemarkPlugins: [
{
resolve: "gatsby-remark-images",
options: {
maxWidth: 720,
wrapperStyle: (fluidResult) => {
let [, name] = fluidResult.originalName.match(
/(.+?)(\.[^.]*$|$)/
)
let borderColor = name.endsWith("-dark") ? "#52595D" : "#F7FAFC"
return `margin: 50px 0; border: 8px solid ${borderColor};`
},
},
},
],
},
},
// Make sure this comes at the end!
{
resolve: `gatsby-plugin-purgecss`,
options: {
extractors: [
{
extractor: (content) => {
return content.match(/[\w-/:+]+(?<!:)/g) || []
},
extensions: ["js", "ts", "jsx", "tsx", "mdx"],
},
],
purgeOnly: ["/tailwind-utils.css"],
/*
This is needed because our focus-visible Tailwind plugin adds the
[data-focus-visible-addded] attribute at runtime using JS, but the
generated css file has it in the classname. So purge won't ever find
a match in our raw source. So we add it here to trick purge into thinking
it matches the "data-focus-visible-added" string in every file.
*/
whitelist: ["data-focus-visible-added"],
content: [
path.join(process.cwd(), "src/**/!(*.d).{ts,js,jsx,tsx,mdx}"),
],
},
},
],
}