forked from andyaiken/forgesteel
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvite-plugin-manifest.ts
More file actions
52 lines (49 loc) · 1.24 KB
/
vite-plugin-manifest.ts
File metadata and controls
52 lines (49 loc) · 1.24 KB
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
import type { Plugin } from 'vite';
export function manifestPlugin(): Plugin {
return {
name: 'manifest-plugin',
generateBundle(_, bundle) {
// Find the shield icon in the bundle
const shieldIcon = Object.keys(bundle).find(
key => key.includes('shield') && key.endsWith('.png')
);
if (shieldIcon) {
const manifest = {
name: 'Forge Steel',
short_name: 'Forge Steel',
description:
'Heroes, monsters, encounters ... everything you need for Draw Steel.',
start_url: '/forgesteel/',
display: 'standalone',
background_color: '#ffffff',
theme_color: '#1890ff',
orientation: 'any',
scope: '/forgesteel/',
icons: [
{
src: `/forgesteel/${shieldIcon}`,
sizes: '192x192',
type: 'image/png',
purpose: 'any maskable'
},
{
src: `/forgesteel/${shieldIcon}`,
sizes: '512x512',
type: 'image/png',
purpose: 'any maskable'
}
],
categories: [ 'games', 'entertainment', 'utilities' ],
lang: 'en',
dir: 'ltr'
};
// Write the manifest to the dist folder
this.emitFile({
type: 'asset',
fileName: 'manifest.json',
source: JSON.stringify(manifest, null, 2)
});
}
}
};
}