/
clutch.config.js
126 lines (120 loc) · 3.85 KB
/
clutch.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
const fs = require( "fs" );
const path = require( "path" );
const files = require( "./server/core/files" );
const root = path.resolve( __dirname );
const rootConfig = files.read( path.join( root, ".clutch", "config.json" ), true );
// If we're in local sandbox then these come from .clutch/config.json as above.
// However, Netlify / CircleCI doesn't have the config JSON so we use environment variables.
const envVars = {
apiAccess: rootConfig.prismic.apiAccess || process.env.PRISMIC_API_ACCESS,
accessToken: rootConfig.prismic.accessToken || process.env.PRISMIC_API_TOKEN,
webhookSecret: rootConfig.prismic.webhookSecret || process.env.PRISMIC_API_SECRET,
};
const config = {
// The URL of your actual site, prod domain: `clutch.kitajchuk.com`
url: "https://clutch.kitajchuk.com",
// Theme to load from ./source and ./template
theme: rootConfig.theme,
// Homepage UID, make sure it matches what you use in Prismic
homepage: "home",
// Page Not Found UID — 404
notfound: "404",
// Page Server Error UID - 500
notright: "500",
// Timestamp ( Stamp of instantiation )
timestamp: Date.now(),
// Single page web application
onepager: false,
// Environments
env: {
sandbox: (process.env.NODE_ENV === "sandbox"),
dev: (process.env.NODE_ENV === "dev"),
prod: (process.env.NODE_ENV === "prod"),
},
// AWS S3 bucket origins for environments (dev:dev, prod:master)
aws: {
buckets: {
dev: "clutch-dev.kitajchuk.com",
prod: "clutch.kitajchuk.com",
},
region: "us-west-2",
},
// Content service API
api: {
adapter: "prismic",
access: envVars.apiAccess,
token: envVars.accessToken,
secret: envVars.webhookSecret,
// Set this to the Label of your Prismic release to query that ref
release: "",
// For linked documents these will always be useing in Prismic api querying
// https://prismic.io/docs/rest-api/query-the-api/fetch-linked-document-fields
fetchLinks: [
"page.title",
"page.image",
"page.description"
]
},
// Templating config
template: {
module: "ejs",
dir: path.join( root, "template", rootConfig.theme ),
layout: path.join( root, "template", rootConfig.theme, "index.html" ),
pagesDir: path.join( root, "template", rootConfig.theme, "pages" ),
partialsDir: path.join( root, "template", rootConfig.theme, "partials" ),
staticDir: path.join( root, "static" )
},
// Express.js config
express: {
port: 8000
},
// Browser-sync config
browser: {
port: 8001
},
// Static assets config
static: {
// One day
maxAge: 86400000,
js: `/js/app.js`,
css: `/css/screen.css`,
minify: {
// html-minifier config
html: {
caseSensitive: true,
collapseWhitespace: true,
collapseInlineTagWhitespace: false,
keepClosingSlash: false,
minifyCSS: true,
minifyJS: true,
removeComments: true,
removeEmptyAttributes: true,
removeRedundantAttributes: true
}
}
},
// Compression js config
compression: {
level: 9,
threshold: 0
},
// Generators config ( sitemap.xml, robots.txt, static build )
generate: {
sitemap: {
site: false
},
robots: {
site: false,
page: false
},
mappings: {
// For onepager to map a :uid to homepage ( root )
// uid?: "/"
}
}
};
// Local dev URL
if ( config.env.sandbox ) {
config.url = `http://localhost:${config.browser.port}`;
}
module.exports = config;