itgalaxy / favicons

Favicons generator for Node.js
MIT License
1.19k stars 165 forks source link

`icons.<platform>.sizes` weird behaviour #434

Closed MrFoxPro closed 1 year ago

MrFoxPro commented 1 year ago
icons: {
  android: {
     rotate: false,
     transparent: true,
     sizes: [{ width: 48, height: 48 }],
  },
 }

Using this configuration in JS API leads to generation of following icons: image And all are the same size (expected to generate single icon 48x48). However, setting


android: [
   'android-chrome-48x48.png',
],
``` works fine and produces only `android-chrome-48x48.png`.
andy128k commented 1 year ago

That's a confusing behavior but that's what happens when you maintains backward compatibility. :shrug:


When an object is specified it is interpreted as an override to every icon from a default set. But when array is specified it overrides the set of icons to be generated.

Consider:

android: { rotate: true }, // rotate every icon

and

android: [
   'android-chrome-48x48.png', // 48x48 image is generated with default settings
   {
      name: 'android-chrome-72x72.png',
      rotate: true,
   },
],

Pay attention that file name is mandatory when you want to specify which sizes to generate.

MrFoxPro commented 1 year ago

I switched to https://github.com/vite-pwa/assets-generator

Yannik commented 12 months ago

Thanks @andy128k!

Unfortunately, the documentation is not too clear about this, but your comment really helped me out!