Skip to content

Commit b8f5ff2

Browse files
committed
refactor: code improvements
1 parent e9e2e82 commit b8f5ff2

File tree

5 files changed

+33
-20
lines changed

5 files changed

+33
-20
lines changed

.env

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
VITE_APP_NAME=Jpool
2+
#VITE_APP_SHORT_NAME
3+
#VITE_APP_DESCRIPTION=
4+
#VITE_APP_KEYWORDS=
5+
6+
# sitemap hostname
7+
#VITE_APP_URL=
8+
9+
# sentry
10+
#VITE_SENTRY_DSN=

public/favicon.svg

Lines changed: 4 additions & 4 deletions
Loading

src/App.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ const primaryColor = '#28414c'
44
const baseURL = import.meta.env.BASE_URL || '/'
55
66
useHead({
7-
title: 'Starter Webapp',
7+
title: import.meta.env.VITE_APP_NAME || 'Starter',
88
meta: [
9-
{ name: 'description', content: '' },
10-
{ name: 'keywords', content: '' },
9+
{ name: 'description', content: import.meta.env.VITE_APP_DESCRIPTION },
10+
{ name: 'keywords', content: import.meta.env.VITE_APP_KEYWORDS },
1111
{
1212
name: 'theme-color',
1313
content: () => isDark.value ? primaryColor : '#ffffff',

types/env.d.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ type ImportMetaEnv = {
44
readonly MODE: 'production' | 'development' | 'staging'
55
readonly VERSION: string
66

7-
readonly VITE_SENTRY_DSN?: string
87
readonly VITE_APP_URL?: string
8+
readonly VITE_APP_NAME?: string
9+
readonly VITE_APP_SHORT_NAME?: string
10+
readonly VITE_APP_DESCRIPTION?: string
11+
readonly VITE_APP_KEYWORDS?: string
12+
readonly VITE_SENTRY_DSN?: string
913
}

vite.config.ts

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -120,29 +120,30 @@ export default defineConfig(({ mode, isSsrBuild }) => {
120120
VitePWA({
121121
registerType: 'autoUpdate',
122122
workbox: {
123-
navigateFallback: '404.html',
124-
offlineGoogleAnalytics: true,
123+
navigateFallback: '/404.html',
124+
globPatterns: ['**/*.{js,css,webp,png,svg,gif,mp4,ico,woff2}'],
125125
},
126-
includeAssets: ['/*.{ico,svg,png}'],
127-
// includeAssets: ['favicon.ico', 'favicon.svg', 'favicon-dark.svg', 'safari-pinned-tab.svg'],
126+
includeAssets: ['**/*.{webp,png,jpg,svg,gif,ico,txt,woff2}'],
128127
manifest: {
129-
name: 'Jpool',
130-
short_name: 'Jpool',
128+
name: env.VITE_APP_NAME ?? 'Starter',
129+
short_name: env.VITE_APP_SHORT_NAME ?? env.VITE_APP_NAME ?? 'Starter',
130+
description: env.VITE_APP_DESCRIPTION,
131131
theme_color: '#ffffff',
132+
display: 'minimal-ui',
132133
icons: [
133134
{
134-
src: `pwa-192x192.png`,
135+
src: '/pwa-192x192.png',
135136
sizes: '192x192',
136137
type: 'image/png',
137138
},
138139
{
139-
src: `pwa-512x512.png`,
140+
src: '/pwa-512x512.png',
140141
sizes: '512x512',
141142
type: 'image/png',
142143
},
143144
{
144-
src: `favicon.svg`,
145-
sizes: '165x165',
145+
src: '/favicon.svg',
146+
sizes: '50x50',
146147
type: 'image/svg',
147148
purpose: 'any maskable',
148149
},
@@ -183,8 +184,6 @@ export default defineConfig(({ mode, isSsrBuild }) => {
183184
preload: 'swap',
184185
pruneSource: true,
185186
reduceInlineStyles: false,
186-
inlineFonts: false,
187-
preloadFonts: false,
188187
},
189188
includedRoutes(paths) {
190189
const staticPaths = paths.filter(path => !path.includes(':'))

0 commit comments

Comments
 (0)