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

Separate maskable / non-maskable images #51

Open
theguacamoleking opened this issue Sep 19, 2024 · 0 comments
Open

Separate maskable / non-maskable images #51

theguacamoleking opened this issue Sep 19, 2024 · 0 comments

Comments

@theguacamoleking
Copy link

theguacamoleking commented Sep 19, 2024

Hello there!

I'm currently using vite-plugin-favicons-inject but would love to move to this tool. I'm currently hitting an issue where I'm not sure how to specify the maskable and non-maskable image 🤔

As an example, here's how this is done with vite-plugin-favicons-inject

viteFaviconsInject(
  'favicon.svg',
  {
    manifestMaskable: './favicon-maskable.svg', // <- different image for maskable
  }
)

And the resulting output in the manifest looks like this

{
  // ...
  "icons": [
    {
      "src": "/android-chrome-36x36.png",
      "sizes": "36x36",
      "type": "image/png",
      "purpose": "any"
    },
    {
      "src": "android-chrome-maskable-36x36.png",
      "sizes": "36x36",
      "type": "image/png",
      "purpose": "maskable" // <- maskable image takes precedence
    },
  ]
}

Proposal

User can specify maskable/non-maskable from config

export default defineConfig({
  preset,
  images: [
    { path: 'src/favicon.svg', maskable: false },
    { path: 'src/favicon-maskable.svg', maskable: true }
  ]
})

In combination with vite-plugin-pwa, the app manifest will be generated containing maskable and non-maskable definitions (see above)

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

1 participant