-
Notifications
You must be signed in to change notification settings - Fork 0
/
nuxt.config.js
168 lines (154 loc) · 3.74 KB
/
nuxt.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
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
import { getAll } from "./apiCalls";
export default {
srcDir: "src/",
target: "static",
env: {
baseUrl: process.env.BASE_URL || "https://adrianjost.dev",
},
/**
* Headers of the page
* more are defined in the default layout
*/
head: {
htmlAttrs: {
lang: "en",
prefix: "og: http://ogp.me/ns#",
},
titleTemplate: (titleChunk) =>
titleChunk ? `Adrian Jost | ${titleChunk}` : "Adrian Jost",
meta: [
{ charset: "utf-8" },
{ name: "viewport", content: "width=device-width, initial-scale=1" },
],
link: [{ rel: "icon", type: "image/png", href: "/icon.png" }],
__dangerouslyDisableSanitizers: ["script"],
script: [
{
innerHTML: `!function(n,e){var t,o,i,c=[],f={passive:!0,capture:!0},r=new Date,a="pointerup",u="pointercancel";function p(n,c){t||(t=c,o=n,i=new Date,w(e),s())}function s(){o>=0&&o<i-r&&(c.forEach(function(n){n(o,t)}),c=[])}function l(t){if(t.cancelable){var o=(t.timeStamp>1e12?new Date:performance.now())-t.timeStamp;"pointerdown"==t.type?function(t,o){function i(){p(t,o),r()}function c(){r()}function r(){e(a,i,f),e(u,c,f)}n(a,i,f),n(u,c,f)}(o,t):p(o,t)}}function w(n){["click","mousedown","keydown","touchstart","pointerdown"].forEach(function(e){n(e,l,f)})}w(n),self.perfMetrics=self.perfMetrics||{},self.perfMetrics.onFirstInputDelay=function(n){c.push(n),s()}}(addEventListener,removeEventListener);`,
type: "text/javascript",
charset: "utf-8",
},
],
},
icon: {
// Icon options
sizes: [16, 120, 144, 152, 192, 384, 512, 1024, 2048],
},
manifest: {
name: "Adrian Jost",
short_name: "Adrian Jost",
lang: "de-de",
start_url: "/?homescreen=true",
display: "standalone",
background_color: "#fff",
theme_color: "#FF1744",
},
/*
** Customize the progress-bar color
*/
loading: { color: "#fff" },
/*
** Global CSS
*/
css: ["@styles/base.scss"],
/*
** Plugins to load before mounting the App
*/
plugins: [{ src: "~/plugins/performance.js", mode: "client" }],
/*
** Nuxt.js modules
*/
modules: ["@nuxtjs/pwa", "@nuxtjs/sitemap"],
sitemap: {
hostname: process.env.BASE_URL || "https://adrianjost.dev",
filter({ routes }) {
return routes.filter((route) => !route.url.includes("admin"));
},
},
/*
** Build configuration
*/
router: {
base: process.env.BASE || "/",
},
build: {
analyze: false,
quiet: false,
html: {
minify: {
collapseWhitespace: true,
conservativeCollapse: true,
collapseBooleanAttributes: true,
decodeEntities: true,
minifyCSS: true,
minifyJS: true,
processConditionalComments: true,
removeEmptyAttributes: true,
removeRedundantAttributes: true,
trimCustomFragments: true,
useShortDoctype: true,
},
},
babel: {
presets({ isServer }) {
return [
[
require.resolve("@nuxt/babel-preset-app"),
{
buildTarget: isServer ? "server" : "client",
corejs: { version: 3 },
},
],
];
},
},
/*
** You can extend webpack config here
*/
extend(config, ctx) {
// Run ESLint on save
if (ctx.isDev && process.client) {
config.module.rules.push({
enforce: "pre",
test: /\.(js|vue)$/,
loader: "eslint-loader",
exclude: /(node_modules)/,
});
}
config.node = {
fs: "empty",
};
},
},
generate: {
routes() {
return getAll().then((data) => {
return [
"/",
"/projects",
"/contact",
"/admin",
"/admin/nigol",
"/admin/about",
].map((route) => ({
route: route,
url: route,
payload: data,
}));
});
},
},
render: {
bundleRenderer: {
shouldPreload: (file, type) => {
if (["script", "style"].includes(type)) {
return true;
}
if (type === "font") {
return file.endsWith(".woff2");
}
return false;
},
},
},
};