forked from cloudflare/workers-docs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gatsby-config.js
82 lines (80 loc) · 2.84 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
const path = require('path')
module.exports = {
siteMetadata: {
title: `Cloudflare Workers`,
description: `Use Cloudflare’s APIs and edge network to build secure, ultra-fast applications.`,
author: `@cloudflaredev`,
},
assetPrefix: `/workers`,
// pathPrefix: `/workers`,
// pathPrefix: `/workers`, // this breaks MDX links like (/reference..) but not the sidebar for some reason if it's inside MDX Render it breaks only
plugins: [
`gatsby-plugin-typescript`,
`gatsby-plugin-react-helmet`,
`gatsby-plugin-react-helmet`,
{
resolve: `gatsby-source-filesystem`,
options: {
name: `mdx-pages`,
path: `${__dirname}/src/content`,
ignore: [`**/CONTRIBUTING*`, '/styles/**'],
},
},
{
resolve: `gatsby-plugin-mdx`,
options: {
extensions: [`.mdx`, `.md`],
// gatsbyRemarkPlugins: [
// {
// resolve: 'gatsby-plugin-copy-files',
// options: {
// source: `${__dirname}/src/images`,
// destination: '/images',
// },
// },
// ],
},
}, // Simple config, passing URL
// In your gatsby-config.js
{
resolve: 'gatsby-source-rest-api',
options: {
endpoints: ['https://template-registry.developers.workers.dev/templates'],
},
},
...require('glob')
// TODO: instead of serving images this complicated way, change links to root
// e.g. (/tooling/media/image.jpq) to ref current directory (e.g. ./media/image.jpg)
.sync(path.join(__dirname, './src/static'))
.map(source => {
// console.log('path.join', path.join(__dirname, './src'))
const destination = source.replace(path.join(__dirname, './src/content'), '')
return {
resolve: 'gatsby-plugin-copy-files',
options: {
source,
destination: destination,
},
}
}),
...require('glob')
// TODO: instead of serving images this complicated way, change links to root
// e.g. (/tooling/media/image.jpg) to ref current directory (e.g. ./media/image.jpg)
// this place all images under media directoy into their current folder under content for gatsby
// then gatsby figured out who to put it in current folder at public/workers/..
.sync(path.join(__dirname, './src/**/media'))
.map(source => {
// console.log('source', source)
// console.log('path.join', path.join(__dirname, './src'))
const destination = source.replace(path.join(__dirname, './src/static'), '')
// console.log('desination', destination)
return {
resolve: 'gatsby-plugin-copy-files',
options: {
source,
destination: source.replace(path.join(__dirname, './src/content'), 'workers'),
},
}
}),
],
}