Skip to content

Commit 4d4f510

Browse files
committed
fix(ipfs): Added ipfs compile option back in
1 parent 4559a9e commit 4d4f510

File tree

1 file changed

+51
-41
lines changed

1 file changed

+51
-41
lines changed

gatsby-config.js

Lines changed: 51 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,6 @@
1-
// const ipfsPrefix = process.argv.find(val => val === '--prefix-paths')
2-
// console.log('DEBUG >> IM HERE')
3-
4-
// const ipfsConfig = [
5-
// 'gatsby-plugin-ipfs',
6-
// 'gatsby-plugin-react-helmet',
7-
// {
8-
// resolve: 'gatsby-source-filesystem',
9-
// options: {
10-
// start_url: '__GATSBY_IPFS_PATH_PREFIX__',
11-
// name: 'images',
12-
// path: `${__dirname}/src/images`
13-
// }
14-
// },
15-
// 'gatsby-transformer-sharp',
16-
// 'gatsby-plugin-sharp',
17-
// {
18-
// resolve: 'gatsby-plugin-manifest',
19-
// options: {
20-
// name: 'gatsby-starter-default',
21-
// short_name: 'starter',
22-
// start_url: '__GATSBY_IPFS_PATH_PREFIX__',
23-
// background_color: '#663399',
24-
// theme_color: '#663399',
25-
// display: 'minimal-ui',
26-
// icon: 'src/images/gatsby-icon.png' // This path is relative to the root of the site.
27-
// }
28-
// }
29-
//
30-
// // this (optional) plugin enables Progressive Web App + Offline functionality
31-
// // To learn more, visit: https://gatsby.dev/offline
32-
// // `gatsby-plugin-offline`,
33-
// ]
1+
const ipfsPrefix = process.argv.find(val => val === '--prefix-paths')
342

3+
// Normal build for sites served with nginx or Apache.
354
const normalConfig = [
365
'gatsby-plugin-react-helmet',
376
{
@@ -62,13 +31,54 @@ const normalConfig = [
6231
// `gatsby-plugin-offline`,
6332
]
6433

65-
module.exports = {
66-
siteMetadata: {
67-
title: 'Gatsby IPFS Adminlte Starter',
68-
description: 'A gatsbyjs app with adminlte2 integration.',
69-
author: '@gatsbyjs'
34+
// Building for deployment over IPFS or with UncensorablePublishing.com tools.
35+
const ipfsConfig = [
36+
'gatsby-plugin-ipfs',
37+
'gatsby-plugin-react-helmet',
38+
{
39+
resolve: 'gatsby-source-filesystem',
40+
options: {
41+
start_url: '__GATSBY_IPFS_PATH_PREFIX__',
42+
name: 'images',
43+
path: `${__dirname}/src/images`
44+
}
7045
},
71-
// pathPrefix: '__GATSBY_IPFS_PATH_PREFIX__',
72-
// plugins: ipfsPrefix ? normalConfig : ipfsConfig
73-
plugins: normalConfig
46+
'gatsby-transformer-sharp',
47+
'gatsby-plugin-sharp',
48+
{
49+
resolve: 'gatsby-plugin-manifest',
50+
options: {
51+
name: 'gatsby-starter-default',
52+
short_name: 'starter',
53+
start_url: '__GATSBY_IPFS_PATH_PREFIX__',
54+
background_color: '#663399',
55+
theme_color: '#663399',
56+
display: 'minimal-ui',
57+
icon: 'src/images/gatsby-icon.png' // This path is relative to the root of the site.
58+
}
59+
}
60+
61+
// this (optional) plugin enables Progressive Web App + Offline functionality
62+
// To learn more, visit: https://gatsby.dev/offline
63+
// `gatsby-plugin-offline`,
64+
]
65+
66+
// Common settings to export.
67+
const exportObj = {
68+
siteMetadata: {
69+
title: 'FullStack.cash Web Wallet',
70+
description: 'A BCH web wallet that uses FullStack.cash for its back end.',
71+
author: '@christroutner'
72+
}
7473
}
74+
75+
// Build for IPFS
76+
if (ipfsPrefix) {
77+
exportObj.pathPrefix = '__GATSBY_IPFS_PATH_PREFIX__'
78+
exportObj.plugins = ipfsConfig
79+
} else {
80+
// Build for normal
81+
exportObj.plugins = normalConfig
82+
}
83+
84+
module.exports = exportObj

0 commit comments

Comments
 (0)