-
Notifications
You must be signed in to change notification settings - Fork 0
/
nuxt.config.js
155 lines (154 loc) · 4.14 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
import postcssPresetEnv from 'postcss-preset-env'
import postcssEasingGradients from 'postcss-easing-gradients'
import * as SITE_INFO from './content/site/info.json'
import { COLOR_MODE_FALLBACK } from './utils/globals.js'
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 || 'http://createADotEnvFileAndSetURL'
: 'http://localhost:3000',
lang: SITE_INFO.sitelang || 'en-US'
},
/*
** 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=Inter:wght@400;600;700&display=swap'
},
{
rel: 'stylesheet',
href: 'https://fonts.googleapis.com/css2?family=Inter:wght@400;600;700&display=swap',
media: 'print',
onload: `this.media='all'`
}
], // ? Imports the font 'Inter', can be optimized by the netlify plugin 'Subfont' by uncommenting it in `netlify.toml`
noscript: [
{
innerHTML:
'<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Inter:wght@400;600;700&display=swap">'
}
],
__dangerouslyDisableSanitizers: ['noscript']
},
/*
** Customize the progress-bar color
*/
loading: { color: '#526488' },
/*
** Global CSS
*/
css: ['@/assets/css/main.pcss'],
/*
** Plugins to load before mounting the App
*/
plugins: ['~/plugins/vue-content-placeholders.js'],
/*
** Nuxt.js dev-modules
*/
buildModules: ['@nuxtjs/color-mode', '@nuxtjs/tailwindcss', '@nuxtjs/svg', '@nuxtjs/pwa'],
/*
** Nuxt.js modules
*/
modules: ['@nuxt/content', 'nuxt-purgecss'],
/*
** Build configuration
*/
build: {
extractCSS: true,
postcss: {
plugins: {
'postcss-preset-env': postcssPresetEnv({
stage: 1,
features: {
'nesting-rules': false
}
}),
'postcss-easing-gradients': postcssEasingGradients
}
},
/*
** You can extend webpack config here
*/
extend(config, ctx) {}
},
/*
** Custom additions configuration
*/
// ? The content property: https://content.nuxtjs.org/configuration
content: {
dir: 'content'
},
tailwindcss: {
viewer: false, // disabled because it causes `Error: Cannot find module 'tailwindcss/resolveConfig'`, fixed in https://github.com/nuxt-community/tailwindcss-module/pull/303
cssPath: '~/assets/css/main.pcss',
exposeConfig: false // enables `import { theme } from '~tailwind.config'`
},
purgeCSS: {
mode: 'postcss',
// ? Safelisting docs: https://purgecss.com/safelisting.html
safelist: {
// standard: [],
deep: [/dark/, /light/, /btn/, /icon/, /main/],
greedy: [
/^card/,
/image$/,
/title$/,
/^nuxt-content/,
/code/,
/pre/,
/token/,
/^vue-content-placeholders/
]
}
},
colorMode: {
classSuffix: '',
preference: 'system', // default value of $colorMode.preference
fallback: COLOR_MODE_FALLBACK, // fallback value if not system preference found
componentName: 'ColorScheme',
cookie: {
options: {
sameSite: 'lax'
}
}
},
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'
}
}
}