-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathvite.config.js
83 lines (79 loc) · 2.08 KB
/
vite.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
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import { quasar, transformAssetUrls } from '@quasar/vite-plugin'
import mdPlugin from 'vite-plugin-markdown'
import { VitePWA } from 'vite-plugin-pwa'
const md = require('markdown-it')()
.use(require('markdown-it-mark'))
md.options.html = true
md.renderer.rules.link_open = function (tokens, idx, options, env, self) {
const token = tokens[idx]
const href = token.attrs[token.attrIndex('href')][1]
if (href.startsWith('/')) {
return `<router-link to='${href}'>`
} else {
return `<a href='${href}' target='_blank'>`
}
}
md.renderer.rules.link_close = function (tokens, idx, options, env, self) {
const token = tokens[idx - 2]
const href = token.attrs[token.attrIndex('href')][1]
if (href.startsWith('/')) {
return '</router-link>'
} else {
return '</a>'
}
}
// https://vitejs.dev/config/
export default defineConfig({
plugins: [
vue({
template: { transformAssetUrls }
}),
VitePWA({
registerType: 'prompt',
devOptions: {
enabled: true
},
manifest: {
name: "traQ Bot Console",
short_name: "traQ Bot Console",
icons: [
{
src: 'pwa-192x192.png',
sizes: '192x192',
type: 'image/png'
},
{
src: 'pwa-512x512.png',
sizes: '512x512',
type: 'image/png'
},
{
src: 'pwa-512x512.png',
sizes: '512x512',
type: 'image/png',
purpose: 'any'
},
{
src: 'pwa-512x512.png',
sizes: '512x512',
type: 'image/png',
purpose: 'maskable'
}
],
start_url: "./index.html",
theme_color: "#ffffff",
background_color: "#ffffff",
display: "standalone"
}
}),
// @quasar/plugin-vite options list:
// https://github.com/quasarframework/quasar/blob/dev/vite-plugin/index.d.ts
quasar({}),
mdPlugin({
mode: ['html', 'vue'],
markdownIt: md,
})
],
})