-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathnuxt.config.js
162 lines (161 loc) · 4.18 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
import path from 'path'
import postcssImport from 'postcss-import'
// import postcssNesting from 'postcss-nesting'
import postcssPresetEnv from 'postcss-preset-env'
import postcssEasingGradients from 'postcss-easing-gradients'
import * as SITE_INFO from './content/site/info.json'
import fs from 'fs'
export default {
target: 'static',
components: true,
generate: {
fallback: true,
},
// ? The env Property: https://nuxtjs.org/api/configuration-env/
env: {
url: process.env.NODE_ENV === 'production' ? process.env.URL || 'https://mirko.nz' : 'http://localhost:3000',
lang: SITE_INFO.sitelang || 'en-NZ',
},
app: {
head: {
bodyAttrs: {
class: 'overflow-hidden',
},
},
},
/*
** Headers of the page
*/
head: {
title: SITE_INFO.sitename || process.env.npm_package_name || '',
meta: [
{ charset: 'utf-8' },
{ name: 'viewport', content: 'width=device-width, initial-scale=1' },
{
hid: 'description',
name: 'description',
content: SITE_INFO.sitedescription || process.env.npm_package_description || '',
},
],
link: [
{
rel: 'preconnect',
href: 'https://fonts.gstatic.com',
crossorigin: true,
},
{
rel: 'preload',
as: 'style',
href: 'https://fonts.googleapis.com/css2?family=Raleway:wght@300;600;700&display=swap',
},
{
rel: 'stylesheet',
href: 'https://fonts.googleapis.com/css2?family=Raleway:wght@300;600;700&display=swap',
media: 'print',
onload: `this.media='all'`,
},
],
noscript: [
{
innerHTML:
'<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Raleway:wght@300;600;700&display=swap">',
},
],
__dangerouslyDisableSanitizers: ['noscript'],
},
/*
** Customize the progress-bar color
*/
loading: { color: '#a2ff00' },
/*
** Global CSS
*/
css: ['@/assets/css/main.css'],
/*
** Plugins to load before mounting the App
*/
plugins: ['~/plugins/vue-content-placeholders.js'],
/*
** Nuxt.js dev-modules
*/
buildModules: ['@nuxtjs/tailwindcss', '@nuxtjs/svg', '@nuxtjs/pwa'],
/*
** Nuxt.js modules
*/
modules: ['@nuxt/content', 'nuxt-purgecss'],
/*
** Build configuration
*/
build: {
extractCSS: true,
postcss: {
plugins: {
'postcss-import': postcssImport,
tailwindcss: path.resolve(__dirname, './tailwind.config.js'),
// 'postcss-nesting': postcssNesting,
'postcss-preset-env': postcssPresetEnv({
stage: 1,
features: {
'nesting-rules': true,
},
}),
'postcss-easing-gradients': postcssEasingGradients,
},
},
/*
** You can extend webpack config here
*/
extend(config, ctx) {
config.module.rules.push({
test: /\.(frag|vert|glsl)$/,
use: [
{
loader: 'glsl-shader-loader',
options: {},
},
],
})
},
},
// file: {
// module: {
// loaders: [
// {
// test: /\.glsl$/,
// loader: 'webpack-glsl',
// },
// ],
// },
// },
/*
** Custom additions configuration
*/
// ? The content property: https://content.nuxtjs.org/configuration
content: {
dir: 'content',
},
tailwindcss: {
cssPath: '~/assets/css/main.css',
exposeConfig: false, // enables `import { theme } from '~tailwind.config'`
},
purgeCSS: {
mode: 'postcss',
// ? Whitelisting docs: https://v1.purgecss.com/whitelisting
whitelist: ['dark-mode', 'light-mode', 'btn', 'icon', 'main'],
whitelistPatterns: [/^card/, /^nuxt-content/, /image$/, /title$/],
whitelistPatternsChildren: [/^nuxt-content/, /code/, /pre/, /token/, /^vue-content-placeholders/],
},
pwa: {
icon: {
source: 'static/icon.png',
filename: 'icon.png',
},
manifest: { name: SITE_INFO.sitename || process.env.npm_package_name || '', lang: process.env.lang },
meta: {
name: SITE_INFO.sitename || process.env.npm_package_name || '',
lang: process.env.lang,
ogHost: process.env.URL,
ogImage: '/preview.jpg',
},
},
}