Skip to content

Conversation

@hadimostafapour
Copy link

  const options = {
    icons: {
      favicons: false,
      android: {
          source: ({width, height}) => {
                     return width < 800 ? "/path/to/foo" : "/path/to/bar";
           }
      },
      appleStartup: {
          offset: 2,
          source: "/path/to/asset"
      },
      windows: false,
      yandex: false,
      appleIcon: true,
    },
  };

@andy128k
Copy link
Collaborator

andy128k commented Jun 2, 2023

@hadimostafapour I like the direction where it goes, but I am not sure that such extension of config type is a right thing to do. Let's say, someone wants to specify a source for each platform individually, then they need to pass some dummy source to favicons() function to bypass a validator.

There are other ways to achieve similar result. E.g. extend

type Source = string | Buffer | (string | Buffer)[];
type PerPlatform<T> = Record<PlatformName | '*', T>;

export async function favicons(
  source: Source | PerPlatform<Source>,
  options: FaviconOptions = {}
): Promise<FaviconResponse> {
  // ...
}

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

Successfully merging this pull request may close these issues.

2 participants