-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstatic.config.tsx
66 lines (63 loc) · 2.15 KB
/
static.config.tsx
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
import * as React from 'react';
import * as path from 'path';
// eslint-disable-next-line import/no-extraneous-dependencies
import { buildTeamRoutes } from './src/utils/route';
import { Meta } from './src/utils/types';
import { projects } from './data';
const PRODUCTION_URL = 'https://postmates.io';
const STAGING_URL = 'https://lucid-haibt-0d7d82.netlify.com';
export default {
plugins: ['react-static-plugin-typescript'],
entry: path.join(__dirname, 'src', 'index.tsx'),
extensions: ['.js', '.jsx', '.ts', '.tsx'],
siteRoot: PRODUCTION_URL,
stagingSiteRoot: STAGING_URL,
getRoutes: () => {
const siteRoot = process.env.NODE_ENV === 'production' ? PRODUCTION_URL : STAGING_URL;
const teamRoutes = buildTeamRoutes(projects, siteRoot);
const routes = [
{
path: '/',
component: 'src/pages/ProjectPage.tsx',
getData: () => ({
projects,
title: Meta.Title,
description: Meta.Description,
url: siteRoot,
siteRoot,
}),
},
...teamRoutes,
];
// eslint-disable-next-line no-console
console.log('Routes = ', routes.map(r => r.path));
return routes;
},
Document: ({ Html, Head, Body, children, renderMeta }) => {
const siteRoot = process.env.NODE_ENV === 'production' ? PRODUCTION_URL : STAGING_URL;
return (
<Html>
<Head>
<meta charSet="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="manifest" href={`${siteRoot}/manifest.json`} />
<link rel="shortcut icon" href={`${siteRoot}/favicon.ico`} />
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-27673166-11" />
{/* Add Sentry, analytics */}
<script
dangerouslySetInnerHTML={{
__html: `
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'UA-27673166-11');
`,
}}
/>
{renderMeta.styleTags}
</Head>
<Body>{children}</Body>
</Html>
);
},
};