forked from Koenkk/zigbee2mqtt.io
-
Notifications
You must be signed in to change notification settings - Fork 0
/
vuepress.config.ts
155 lines (142 loc) Β· 4.08 KB
/
vuepress.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
144
145
146
147
148
149
150
151
152
153
154
155
import { navbar } from "./navbar";
import { sidebar } from "./sidebar";
import * as path from "path";
import { PageOptions } from "@vuepress/core";
import defaultTheme from '@vuepress/theme-default';
import webpackBundler from "@vuepress/bundler-webpack";
import * as DefinePlugin from "webpack/lib/DefinePlugin.js";
import { googleAnalyticsPlugin } from "@vuepress/plugin-google-analytics";
import { sitemapPlugin } from 'vuepress-plugin-sitemap2';
import { docsearchPlugin } from "@vuepress/plugin-docsearch";
import { registerComponentsPlugin } from "@vuepress/plugin-register-components";
import { defineUserConfig } from "vuepress";
import { domain, getBase, isDevelop } from "./getBase";
const pagePatterns = ['**/*.md', '!.vuepress', '!node_modules'];
// Ability to exclude device-page rendering to save time while in dev
if (process.env.EXCLUDE_DEVICES) {
pagePatterns.push('!devices');
}
const conf = defineUserConfig({
base: getBase(),
title: 'Zigbee2MQTT' + ( isDevelop ? ' develop' : '' ),
description: 'Zigbee to MQTT bridge, get rid of your proprietary Zigbee bridges',
dest: 'dist',
public: 'public',
temp: '.temp',
cache: '.cache',
// Docu is way too large to prefetch
shouldPrefetch: false,
pagePatterns,
head: [
['script', {}, `if(window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) { window.document.querySelector('html').classList.add('dark');} `
],
['link', {
rel: 'icon',
type: 'image/png',
sizes: '16x16',
href: `${getBase()}favicon-16x16.png`,
}],
['link', {
rel: 'icon',
type: 'image/png',
sizes: '32x32',
href: `${getBase()}favicon-32x32.png`,
}],
['link', {
rel: 'apple-touch-icon',
type: 'image/png',
sizes: '180x180',
href: `${getBase()}apple-touch-icon.png`,
}],
['link', {
rel: 'manifest',
href: `${getBase()}site.webmanifest`,
}],
['link', {
rel: 'mask-icon',
color: '#ffc135',
href: `${getBase()}safari-pinned-tab.svg`,
}],
['meta', {
name: 'msapplication-TileColor',
content: '#ffc135',
}],
['meta', {
name: 'theme-color',
content: '#ffc135',
}],
],
theme: defaultTheme({
repo: 'Koenkk/zigbee2mqtt.io',
repoLabel: 'GitHub (docs)',
docsBranch: isDevelop ? 'develop' : 'master',
editLinkText: 'β Help to make the docu better and edit this page on Github β',
logo: '/logo.png',
docsDir: 'docs',
navbar,
sidebar,
sidebarDepth: 2,
contributors: false,
themePlugins: {
git: true
}
}),
debug: false,
bundler: webpackBundler({
scss: {
sassOptions: {
// ignore sass deprecation errors
quietDeps: true
}
},
chainWebpack: (chain) => {
chain.plugin('define-quasar')
.use(DefinePlugin.default, [{
__QUASAR_VERSION__: `'dev'`,
__QUASAR_SSR__: false,
__QUASAR_SSR_SERVER__: false,
__QUASAR_SSR_CLIENT__: false,
__QUASAR_SSR_PWA__: false
}]);
},
}),
plugins: [
googleAnalyticsPlugin({
id: 'G-H74W4PSJDZ',
}),
sitemapPlugin(
{ hostname: domain }
),
docsearchPlugin({
apiKey: '662e98933c5c5513d7488c30a98770f1',
indexName: 'zigbee2mqtt.io',
appId: 'K1BM3QYQ34',
locales: {
'/': {
placeholder: 'Search',
},
},
}),
registerComponentsPlugin({
componentsDir: path.resolve(__dirname, 'docs/.vuepress/components'),
components: {
SupportedDevices: path.resolve(__dirname, 'supported-devices-component/SupportedDevices.vue'),
}
}),
{
name: 'extendsPageOptions',
extendsPageOptions: (pageOpts: PageOptions) => {
pageOpts.frontmatter = pageOpts.frontmatter ?? {}
const frontmatter = pageOpts.frontmatter;
// Add content-page css class
if (!frontmatter.pageClass) {
frontmatter.pageClass = 'content-page';
}
}
},
],
});
if (isDevelop) {
conf.head.push(['meta', { name: 'robots', content: 'noindex' }]);
}
export default conf;