Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Favicons larger than 48x48 wanted #459

Open
evil-shrike opened this issue Nov 21, 2024 · 1 comment
Open

Favicons larger than 48x48 wanted #459

evil-shrike opened this issue Nov 21, 2024 · 1 comment

Comments

@evil-shrike
Copy link

Hi,
why can't I generate favicons larger than 48x48

I tried:

    favicons: [
      'favicon-16x16.png',
      'favicon-32x32.png',
      'favicon-96x96.png',
      'favicon-128x128.png',
      'favicon.ico',
    ],

but only there were created:
created favicon-16x16.png
created favicon-32x32.png
created favicon.ico

const configuration = {
  logging: false,
  icons: {
    favicons: [
      'favicon-16x16.png',
      'favicon-32x32.png',
      'favicon-96x96.png',
      'favicon-128x128.png',
      'favicon.ico',
    ],
    android: false,
    appleIcon: true,
    appleStartup: false,
    windows: false,
    yandex: false,
  },
};
async function run() {
  const iconsPath = path.join(OUTPUT, 'icons');
  if (!fs.existsSync(iconsPath)) {
    fs.mkdirSync(iconsPath, { recursive: true });
  }

  const response = await favicons(SOURCE, configuration);

  await Promise.all(
    response.images.map(async (image) => {
      let outputPath;
      if (image.name === 'favicon.ico') {
        outputPath = path.join(OUTPUT, image.name);
      } else {
        outputPath = path.join(OUTPUT, 'icons', image.name);
      }
      await fs.promises.writeFile(outputPath, image.contents);
      console.log('created ' + image.name);
    }),
  );
  console.log('Favicon generation completed!');
}
run().catch(console.error);
@andy128k
Copy link
Collaborator

This is not well documented, but options are not allowing to specify arbitrary sizes, rather to select from a pre-defined list of sizes/options.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants