forked from maidsafe/safenetwork.tech
-
Notifications
You must be signed in to change notification settings - Fork 0
/
static.config.js
149 lines (143 loc) · 3.88 KB
/
static.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
138
139
140
141
142
143
144
145
146
147
148
149
import path from 'path'
//
import React from 'react'
import ExtractTextPlugin from 'extract-text-webpack-plugin'
import CompressionPlugin from 'compression-webpack-plugin'
const pageDirPath = 'src/pages'
export default {
getSiteData: () => ({
title: 'React Static',
}),
getRoutes: async () => {
return [
{
path: '/',
component: `${pageDirPath}/Home`,
},
{
path: '/how-it-works/',
component: `${pageDirPath}/HowItWorks`,
},
{
path: '/faq/',
component: `${pageDirPath}/FAQs`,
},
{
path: '/safecoin/',
component: `${pageDirPath}/SafeCoin`,
},
{
path: '/get-involved/',
component: `${pageDirPath}/GetInvolved`,
},
{
path: '/roadmap/',
component: `${pageDirPath}/Roadmap`,
},
{
path: '/press-kit/',
component: `${pageDirPath}/PressKit`,
},
{
path: '/cookies/',
component: `${pageDirPath}/Cookies`,
},
{
path: '/privacy/',
component: `${pageDirPath}/Privacy`,
},
{
path: '/about-maidsafe/',
component: `${pageDirPath}/About`,
},
{
path: '/fundamentals/',
component: `${pageDirPath}/Fundamentals`
},
{
is404: true,
component: `${pageDirPath}/NotFound`,
},
]
},
webpack: (config, { defaultLoaders, stage }) => {
let loaders = []
if (stage === 'dev') {
loaders = [{ loader: 'style-loader' }, { loader: 'css-loader' }, { loader: 'sass-loader' }]
} else {
loaders = [
{
loader: 'css-loader',
options: {
importLoaders: 1,
minimize: stage === 'prod',
sourceMap: false,
},
},
{
loader: 'sass-loader',
options: { includePaths: ['src/'] },
},
]
// Don't extract css to file during node build process
if (stage !== 'node') {
loaders = ExtractTextPlugin.extract({
fallback: {
loader: 'style-loader',
options: {
sourceMap: false,
hmr: false,
},
},
use: loaders,
})
}
}
config.module.rules = [
{
oneOf: [
{
test: /\.s(a|c)ss$/,
use: loaders,
},
defaultLoaders.cssLoader,
defaultLoaders.jsLoader,
defaultLoaders.fileLoader,
],
},
]
config.plugins.push(new CompressionPlugin({
algorithm: 'gzip'
}))
//
config.resolve = {
...config.resolve,
alias: {
styles: path.resolve(__dirname, 'src/styles'),
images: path.resolve(__dirname, 'src/assets/images'),
fonts: path.resolve(__dirname, 'src/assets/fonts'),
components: path.resolve(__dirname, 'src/components'),
src: path.resolve(__dirname, 'src')
}
}
return config
},
Document: ({ Html, Head, Body, children, siteData, renderMeta }) => (
<Html lang="en-US">
<Head>
<meta charSet="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />
<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png" />
<link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png" />
<link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png" />
<link rel="manifest" href="/site.webmanifest" />
<link rel="mask-icon" href="/safari-pinned-tab.svg" color="#444444" />
<link rel="shortcut icon" type="image/icon" href="/favicon.ico" />
<meta name="msapplication-TileColor" content="#da532c" />
<meta name="theme-color" content="#ffffff" />
<title>SAFE Network</title>
</Head>
<Body className="no-js">{children}</Body>
</Html>
),
}