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

Auto pull in references icons in manifest config #211

Closed
kalvenschraut opened this issue Jan 19, 2022 · 3 comments
Closed

Auto pull in references icons in manifest config #211

kalvenschraut opened this issue Jan 19, 2022 · 3 comments
Labels
enhancement New feature or request

Comments

@kalvenschraut
Copy link

I was wondering if it would be possible to have any icons that are referenced to the relative file path in the vite project would then be picked up as a static asset like referencing a static asset in source code. Then the generated manifest would point to the generated icon i.e.

set the below config

VitePWA({
  manifest: {
    icons: [{
      src: './src/assets/images/android-chrome-192x192.png'
      sizes: '192x182',
      type: 'image/png'
    }]
  }
})

The plugin then will generate the manifest referencing the filepath generated by vite similar to how vite does static asset handling. With my setup of assetsDir: 'static' that means I would expect the generated filepath to be something like `/static/android-chrome-192x192.cded8a63.png.

Currently I have to have any of the above icons in my public directory.

@userquin
Copy link
Member

userquin commented Jan 30, 2022

@kalvenschraut workbox is file based, we need to do some additional work: the manifest.webmanifest should be changed (replace each icon src with the final asset name traversing the vite bundle map and find a match) but also the sw precache manifest, since we also need to add/check those entries: for example, if we include an icon from assets, this asset will be excluded by workbox since the default glob pattern doesn't include images files (https://vite-plugin-pwa.netlify.app/guide/static-assets.html#static-assets-handling), but it you change the globPatterns to include images, workbox will include it.

Once #220 merged I'll check if we can add this feature.

@userquin userquin added the enhancement New feature or request label Jan 30, 2022
@alkanna
Copy link

alkanna commented Oct 11, 2022

Hey @userquin , any news on this ?

@userquin
Copy link
Member

@alkanna not yet, too busy, sorry

@userquin userquin closed this as not planned Won't fix, can't repro, duplicate, stale Mar 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants