-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathnuxt.config.js
218 lines (208 loc) · 6.08 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
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
import path from 'path'
import glob from 'glob'
import Mode from 'frontmatter-markdown-loader/mode'
import uslug from 'uslug'
import markdownIt from 'markdown-it'
import markdownItAnchor from 'markdown-it-anchor'
import markdownItAttrs from 'markdown-it-attrs'
import markdownItEmoji from 'markdown-it-emoji'
import markdownItFootnote from 'markdown-it-footnote'
import markdownItImaginations from 'markdown-it-imagination'
import markdownItLinkAttributes from 'markdown-it-link-attributes'
import markdownItHljs from './plugins/markdown-it-hljs'
const CONTENT_DIR = 'content/'
require('dotenv').config()
const metaDescription = 'I bootstrap a profitable business and tweet about it. Building great products is something I love doing.'
const metaImage = 'https://lukashermann.dev/lukashermann-meta-img.jpg'
export default {
env: {
host: process.env.NUXT_ENV_HOST || 'https://lukashermann.dev',
},
router: {
trailingSlash: true,
},
target: 'static',
/*
** Headers of the page
*/
head: {
// if no subcomponents specify a metaInfo.title, this title will be used
title: 'Lukas Hermann – Bootstraping a profitable business',
// all titles will be injected into this template
// titleTemplate: '%s | Lukas Hermann',
meta: [
{ charset: 'utf-8' },
{ name: 'viewport', content: 'width=device-width, initial-scale=1' },
{ hid: 'description', name: 'description', content: metaDescription },
{ name: 'msapplication-TileColor', content: '#E29449' },
{ name: 'theme-color', content: '#E29449' },
{ name: 'theme-color', content: '#E29449' },
{ name: 'twitter:site', content: '@_lhermann' },
{ hid: 'twitter:image', name: 'twitter:image', content: metaImage },
{ hid: 'twitter:card', name: 'twitter:card', content: 'summary_large_image' },
{ hid: 'twitter:title', name: 'twitter:title', content: 'Hi, I\'m Lukas' },
{ hid: 'twitter:description', name: 'twitter:description', content: metaDescription },
{ hid: 'og:title', property: 'og:title', content: 'Hi, I\'m Lukas' },
{ hid: 'og:description', property: 'og:description', content: metaDescription },
{ hid: 'og:image', property: 'og:image', content: metaImage },
{ hid: 'og:url', property: 'og:url', content: 'https://lukashermann.dev' },
],
link: [
{
rel: 'apple-touch-icon',
sizes: '180x180',
href: '/apple-touch-icon.png',
},
{
rel: 'icon',
type: 'image/png',
sizes: '32x32',
href: '/favicon-32x32.png',
},
{
rel: 'icon',
type: 'image/png',
sizes: '16x16',
href: '/favicon-16x16.png',
},
{ rel: 'manifest', href: '/site.webmanifest' },
{ rel: 'mask-icon', href: '/safari-pinned-tab.svg', color: '#E29449' },
{ rel: 'icon', type: 'image/x-icon', href: '/favicon.ico?v=2' },
{ rel: 'preconnect', href: 'https://fonts.googleapis.com' },
{ rel: 'preconnect', href: 'https://fonts.gstatic.com' },
{ rel: 'stylesheet', href: 'https://fonts.googleapis.com/css2?family=Source+Sans+Pro:wght@300;400;600;700&display=swap' },
],
htmlAttrs: {
lang: 'en',
},
},
/*
** Customize the progress-bar color
*/
loading: { color: '#fff' },
/*
** Global CSS
*/
css: [
'@/assets/css/tailwind.css',
'highlight.js/styles/base16/gruvbox-dark-hard.css',
],
/*
** Plugins to load before mounting the App
*/
plugins: [
'@/plugins/email-obfuscate.js',
{ src: '@/plugins/gif-pause.js', mode: 'client' },
],
/**
* Modules for dev and build
* https://go.nuxtjs.dev/config-modules
*/
buildModules: [
'@nuxtjs/eslint-module',
'@nuxtjs/svg',
'@nuxtjs/sitemap',
],
/**
* Modules
* https://go.nuxtjs.dev/config-modules
*/
modules: [
['nuxt-matomo', {
matomoUrl: process.env.NUXT_ENV_MATOMO_URL,
siteId: process.env.NUXT_ENV_MATOMO_SITE_ID,
onMetaChange: true,
cookies: false,
doNotTrack: true,
}],
],
/*
* Generate Dynamic Routes
*/
generate: {
routes: getDynamicRoutes(),
fallback: '404.html',
},
sitemap: {
hostname: process.env.NUXT_ENV_HOST || 'https://lukashermann.dev',
trailingSlash: true,
},
/*
** Build configuration
*/
build: {
extractCSS: true,
loaders: {
vue: {
compilerOptions: {
whitespace: 'condense',
},
},
},
postcss: {
postcssOptions: {
plugins: {
tailwindcss: {},
autoprefixer: {},
},
},
},
/*
** You can extend webpack config here
*/
extend(config, ctx) {
// add frontmatter-markdown-loader
config.module.rules.push({
test: /\.md$/,
include: path.resolve(__dirname, 'content'),
loader: 'frontmatter-markdown-loader',
options: {
mode: [Mode.HTML, Mode.META],
markdownIt: markdownIt({
html: true,
typographer: true,
linkify: true,
highlight: markdownItHljs,
})
.use(markdownItAnchor, {
permalink: markdownItAnchor.permalink.ariaHidden({
placement: 'before',
}),
slugify: s => uslug(s),
})
.use(markdownItAttrs)
.use(markdownItLinkAttributes, {
attrs: { rel: 'noopener' },
})
.use(markdownItEmoji)
.use(markdownItFootnote)
.use(markdownItImaginations),
},
})
},
babel: {
plugins: ['@babel/plugin-proposal-optional-chaining'],
env: {
test: {
presets: ['@babel/preset-env'],
},
},
},
},
// tailwindcss: {
// viewer: false,
// },
}
function getDynamicRoutes () {
// get routes
// const work = pathToRoute(CONTENT_DIR, 'work/*.md')
const work = []
const writing = pathToRoute(CONTENT_DIR, 'writing/*.md')
// return list
return [...work, ...writing]
}
function pathToRoute (base, globStr) {
return glob
.sync(base + globStr)
.map(file => file.replace(base, '').replace('.md', '/'))
}