-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathvite.config.ts
59 lines (52 loc) · 1.96 KB
/
vite.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
import path from 'node:path';
import { cloudflareRedirect } from '@ryoppippi/vite-plugin-cloudflare-redirect';
import { enhancedImages } from '@sveltejs/enhanced-img';
import { sveltekit } from '@sveltejs/kit/vite';
import extractorSvelte from '@unocss/extractor-svelte';
import UnoCss from 'unocss/vite';
import { defineConfig } from 'vite';
import { faviconsPlugin } from 'vite-plugin-favicons';
import { LINKS, VIM_JP_RADIO_INFO } from './src/lib/links/_links.js';
import { theme } from './uno.config.js';
function relativePath(...args: string[]): string {
return path.resolve(import.meta.dirname, ...args);
}
/* unocss から background color を取得 */
const { background } = theme.colors.LP;
export default defineConfig({
plugins: [
/* favicon と metadata の設定 */
faviconsPlugin({
cache: true,
/** ===== faviconsの設定 ===== */
imgSrc: relativePath('./src/assets/vimjp-radio-cover-art/3000x3000-fs8.png'),
/** ========================= */
/* ===== metadataの設定 ===== */
path: `/favicons`,
theme_color: background,
background,
appName: VIM_JP_RADIO_INFO.title,
appShortName: VIM_JP_RADIO_INFO.title,
appDescription: VIM_JP_RADIO_INFO.description,
lang: 'ja-JP',
orientation: 'portrait',
/* ========================= */
}),
/* `_redirects`ファイルを生成するための設定 */
cloudflareRedirect({
mode: 'generate',
redirectsFilePath: relativePath('./static/_redirects'),
entries: [
{ from: '/audee', to: LINKS.AuDee.url },
{ from: '/apple', to: LINKS.ApplePodcast.url },
{ from: '/amazon', to: LINKS.AmazonMusic.url },
{ from: '/spotify', to: LINKS.Spotify.url },
{ from: '/youtube', to: LINKS.Youtube.url },
{ from: '/suzuri', to: LINKS.Suzuri.url },
],
}),
UnoCss({ extractors: [extractorSvelte()] }), // UnoCssの設定。extractorsにextractorSvelteを設定している。https://unocss.dev/extractors/svelte#svelte-extractor
enhancedImages(),
sveltekit(),
],
});