Skip to content

Commit

Permalink
fix: improve app icon
Browse files Browse the repository at this point in the history
  • Loading branch information
Pkcarreno committed Jun 5, 2024
1 parent 8d9f71f commit 6ecd3f1
Show file tree
Hide file tree
Showing 26 changed files with 49 additions and 32 deletions.
11 changes: 8 additions & 3 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,14 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>JSoD - JS on Demand</title>

<link rel="apple-touch-icon" href="/apple-touch-icon.png" />
<link rel="icon" href="/favicon.ico" sizes="48x48" />
<link rel="icon" href="/favicon.svg" sizes="any" type="image/svg+xml" />
<link rel="apple-touch-icon" href="/icons/pwa-icon_x180.png" />
<link rel="icon" href="/icons/favicon.ico" sizes="32x32" />
<link
rel="icon"
href="/icons/favicon.svg"
sizes="any"
type="image/svg+xml"
/>
<meta
name="theme-color"
content="#fdfefb"
Expand Down
Binary file removed public/apple-touch-icon.png
Binary file not shown.
File renamed without changes.
File renamed without changes.
File renamed without changes
Binary file added public/icons/pwa-icon_x1080.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/icons/pwa-icon_x180.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/icons/pwa-icon_x196.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/icons/pwa-icon_x512.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/icons/pwa-maskable_icon_x1080.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/icons/pwa-maskable_icon_x128.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/icons/pwa-maskable_icon_x192.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/icons/pwa-maskable_icon_x384.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/icons/pwa-maskable_icon_x48.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/icons/pwa-maskable_icon_x512.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/icons/pwa-maskable_icon_x64.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/icons/pwa-maskable_icon_x72.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/icons/pwa-maskable_icon_x96.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed public/pwa-192x192.png
Binary file not shown.
Binary file removed public/pwa-512x512.png
Binary file not shown.
Binary file removed public/pwa-maskable-192x192.png
Binary file not shown.
Binary file removed public/pwa-maskable-512x512.png
Binary file not shown.
File renamed without changes
File renamed without changes
File renamed without changes
70 changes: 41 additions & 29 deletions vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,43 @@ const replaceOptions: RollupReplaceOptions = {
preventAssignment: true,
};

const generateIcons = (basePath: string) => {
const MASKABLE_ICONS_SIZES = [
'1080',
'512',
'384',
'192',
'128',
'96',
'72',
'64',
'48',
];
const NO_MASKABLE_ICONS_SIZES = ['1080', '512', '196', '180'];
const MASKABLE_ICONS_NAME = 'pwa-maskable_icon_x';
const NO_MASKABLE_ICONS_NAME = 'pwa-icon_x';

const maskableIcons = MASKABLE_ICONS_SIZES.map((size) => {
return {
src: `${basePath}/icons/${MASKABLE_ICONS_NAME}${size}.png`,
sizes: `${size}x${size}`,
type: 'image/png',
purpose: 'maskable',
};
});

const nonMaskableIcons = NO_MASKABLE_ICONS_SIZES.map((size) => {
return {
src: `${basePath}/icons/${NO_MASKABLE_ICONS_NAME}${size}.png`,
sizes: `${size}x${size}`,
type: 'image/png',
purpose: 'any',
};
});

return [...maskableIcons, ...nonMaskableIcons];
};

export default defineConfig(({ mode }) => {
process.env = { ...process.env, ...loadEnv(mode, process.cwd()) };
process.env.BASE_URL = process.env.VITE_BASE_URL ?? '';
Expand Down Expand Up @@ -50,50 +87,25 @@ export default defineConfig(({ mode }) => {
],
screenshots: [
{
src: `${process.env.BASE_URL}/desktop-1.jpeg`,
src: `${process.env.BASE_URL}/screenshots/desktop-1.jpeg`,
sizes: '1694×930',
type: 'image/jpeg',
form_factor: 'wide',
},
{
src: `${process.env.BASE_URL}/mobile-1.jpeg`,
src: `${process.env.BASE_URL}/screenshots/mobile-1.jpeg`,
sizes: '412×915',
type: 'image/jpeg',
form_factor: 'narrow',
},
{
src: `${process.env.BASE_URL}/mobile-2.jpeg`,
src: `${process.env.BASE_URL}/screenshots/mobile-2.jpeg`,
sizes: '412×915',
type: 'image/jpeg',
form_factor: 'narrow',
},
],
icons: [
{
src: `${process.env.BASE_URL}/pwa-192x192.png`,
sizes: '192x192',
type: 'image/png',
purpose: 'any',
},
{
src: `${process.env.BASE_URL}/pwa-512x512.png`,
sizes: '512x512',
type: 'image/png',
purpose: 'any',
},
{
src: `${process.env.BASE_URL}/pwa-maskable-192x192.png`,
sizes: '192x192',
type: 'image/png',
purpose: 'maskable',
},
{
src: `${process.env.BASE_URL}/pwa-maskable-512x512.png`,
sizes: '512x512',
type: 'image/png',
purpose: 'maskable',
},
],
icons: generateIcons(process.env.BASE_URL),
},
workbox: {
globPatterns: ['**/*.{html,js,css,svg,woff,woff2,ttf,eot,ico,wasm}'],
Expand Down

0 comments on commit 6ecd3f1

Please sign in to comment.