This repository has been archived by the owner on May 2, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
nuxt.config.ts
143 lines (138 loc) · 2.85 KB
/
nuxt.config.ts
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
import { NuxtConfig } from "@nuxt/types"
import {
SITE_NAME,
TWITTER_ID,
SCRAPBOX_PROJECT,
SCRAPBOX_TAG,
GA,
isProduction,
SITE_ROOT,
GSV,
GITHUB_ID,
} from "./src/config"
const config: NuxtConfig = {
/*
** Headers of the page
*/
head: {
htmlAttrs: {
lang: "ja",
},
titleTemplate: `%s | ${SITE_NAME}`,
meta: [
{ charset: "utf-8" },
{ name: "viewport", content: "width=device-width, initial-scale=1" },
{
hid: "description",
name: "description",
content: "My Blog",
},
{
hid: "og:description",
name: "og:description",
content: "My Blog",
},
{
hid: "og:site_name",
name: "og:site_name",
content: SITE_NAME,
},
],
link: [{ rel: "icon", type: "image/jpeg", href: "/favicon.jpg" }],
},
/*
** Customize the progress-bar color
*/
loading: { color: "#fff" },
/*
** Global CSS
*/
css: ["~/assets/css/global.css", "~/assets/css/highlight.css"],
/*
** Plugins to load before mounting the App
*/
plugins: ["~/plugins/highlight.ts"],
/*
** Nuxt.js modules
*/
modules: [
// Doc: https://axios.nuxtjs.org/usage
"@nuxtjs/proxy",
],
/*
** Build configuration
*/
build: {
/*
** You can extend webpack config here
*/
parallel: true,
analyze: process.env.ANALYZE === "yes",
},
buildModules: ["@nuxtjs/tailwindcss", "@nuxt/typescript-build"],
purgeCSS: {
enabled: true,
mode: "postcss",
paths: [
"components/**/*.vue",
"components/**/*.tsx",
"layouts/**/*.vue",
"pages/**/*.vue",
"plugins/**/*.ts",
],
whitelist: ["body", "html", "nuxt-progress"],
whitelistPatterns: [/hljs.*$/],
extractors: [
{
extractor: (content: string) => content.match(/[A-z0-9-:\\/]+/g) || [],
extensions: ["vue", "js", "tsx", "ts"],
},
],
},
srcDir: "./src",
proxy: {
"/api": {
target: `https://scrapbox.io`,
pathRewrite: {
"/api": `/api/pages/${SCRAPBOX_PROJECT}`,
},
},
},
env: {
SCRAPBOX_PROJECT,
SCRAPBOX_TAG,
SITE_NAME,
TWITTER_ID: TWITTER_ID!,
GITHUB_ID: GITHUB_ID!,
SITE_ROOT: SITE_ROOT!,
GA: GA!,
},
}
if (GSV && isProduction && typeof config.head === "object") {
typeof config.head?.meta?.push({
hid: "google-site-verification",
name: "google-site-verification",
content: GSV,
})
}
if (GA && isProduction) {
config.buildModules!.push([
"@nuxtjs/google-analytics",
{
id: GA,
},
])
}
if (TWITTER_ID && typeof config.head === "object") {
config.head!.meta!.push({
hid: "twitter:site",
name: "twitter:site",
content: `@${TWITTER_ID}`,
})
config.head!.meta!.push({
hid: "twitter:card",
name: "twitter:card",
content: "summary",
})
}
export default config