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

No maskable icon support #259

Closed
liyasthomas opened this issue Dec 21, 2019 · 23 comments
Closed

No maskable icon support #259

liyasthomas opened this issue Dec 21, 2019 · 23 comments

Comments

@liyasthomas
Copy link

What problem does this feature solve?

Maskable icons support for PWA is gaining pace in most browsers and still it is not supported in Nuxt PWA module

What does the proposed changes look like?

On nuxt.config.js adding purpose field to PWA images will make icons compatible for maskable icons.

This feature request is available on Nuxt community (#c192)
@ghost ghost added the feature-request label Dec 21, 2019
@EricHier
Copy link

Hi! Has there been progress on this feature? I am looking forward to using it. :)

@nikolayandreev
Copy link

I totally don't understand what is going on..
There is a pull request from 2019 #246
Which seems to be targeting this exact issue.

But here's what I see, you can clearly see that the maskable is working on some places, but not on others, I've tried to leave even more than the recommended safe zone of 48dp and it still doesn't work..

I can see it's cropping while it's installing:
изображение

I can see it cropped on the screen:
изображение

But on the minimize tab for example I see it as a rectangle.. :
изображение

@EricHier
Copy link

This represents my own experience regarding maskable icons pretty well. However I would say that this problem should and will be fixed by chrome (or what ever browser you use under android) and should not be solved by nuxt/pwa.

@FreekVR
Copy link

FreekVR commented Apr 2, 2020

Just came here for this. #246 is now merged, but unfortunately the release has not yet been tagged :(

@pi0 would it be possible to publish a new beta with this feature included? Or is there anything I can do to help get this published? Thanks :)

@wagerfield
Copy link
Contributor

@pi0 I too would really like the icon purpose feature that was merged to be published to npm. It would be awesome if you could publish another beta with this feature included now that it's been merged. Thank you 🙏

@dschox
Copy link

dschox commented Apr 8, 2020

+1

@AllanOricil
Copy link

Could you give us an estimate of when this will be released?
For those who want to create really cool Maskable Icons, use this Tutorial.

https://web.dev/maskable-icon/

@AllanOricil
Copy link

AllanOricil commented Apr 19, 2020

workaround for testing this the purpose feature:
Edit the manifest.json inside .nuxt/dist/client (development) or dist/_nuxt/ (production)

...
"icons": [
    ...
    {
      "src": "/_nuxt/icons/icon_512.a97621.png",
      "sizes": "512x512",
      "type": "image/png",
      "purpose": "any maskable"
    }
  ]
...

To solve my problem while deploying my app to Netlify, I created a small script to insert the purpose property in the manifest.

const fs = require('fs')
//this will look for the dist generated after running nuxt build
let dir = `${process.cwd()}/dist/_nuxt/`
const purpose = ['any', 'maskable']

fs.readdir(dir, (err, files) => {
  if (err) console.log('error: ' + err)
  else
    files.forEach((file) => {
      if (file.includes('manifest')) {
        console.log(`Manifest File Name: ${file}`)
        const manifestPath = `${process.cwd()}/dist/_nuxt/${file}`
        let manifest = fs.readFileSync(manifestPath, 'utf8')
        console.log('BEFORE EDITING')
        console.log(manifest)
        let manifestObj = JSON.parse(manifest)
        manifestObj.icons.forEach((icon) => {
          icon.purpose = purpose.join(' ')
        })
        manifest = JSON.stringify(manifestObj)
        fs.writeFileSync(manifestPath, manifest, 'utf8')
        manifest = fs.readFileSync(manifestPath, 'utf8')
        console.log('AFTER EDITING')
        console.log(manifest)
      }
    })
})

And added it to my package.json

"scripts": {
    "build": "nuxt build && node fix_manifest.js"
}

And this is the script running at Netlify
image

@Glutnix
Copy link

Glutnix commented Jul 24, 2020

Chrome Lighthouse just gave me a point off for not having a maskable icon:

image

@abshirahmed
Copy link

Chrome Lighthouse just gave me a point off for not having a maskable icon:

image

same 😿

@thegoldgoat
Copy link

I am currently using @nuxtjs/pwa@3.0.0-beta.20 from npm
I have set
icon: { purpose: 'maskable' },

Still, the manifest doesn't get any purpose field.

Is there any way to get it working?

@AllanOricil
Copy link

AllanOricil commented Aug 7, 2020

I am currently using @nuxtjs/pwa@3.0.0-beta.20 from npm
I have set
icon: { purpose: 'maskable' },

Still, the manifest doesn't get any purpose field.

Is there any way to get it working?

Manually edit the manifest in the dist folder. or create a script to automate it for you before publishing your site. It worked for me.

@thegoldgoat
Copy link

Manually edit the manifest in the dist folder. or create a script to automate it for you before publishing your site. It worked for me.

I see, thanks for your response!

@pi0
Copy link
Member

pi0 commented Aug 16, 2020

Hi! with 3.0.0 purpose option is available and defaulting to maskable. please be sure to have enough spacing for round icons. notes

@pi0 pi0 closed this as completed Aug 16, 2020
@liyasthomas
Copy link
Author

liyasthomas commented Aug 16, 2020

Working as expected 🎉

@liyasthomas
Copy link
Author

What is the prescribed size / format for static/icon.png? I'm getting the following warning even though I'm using a 512x512px PNG image.

WARN  You are using a low quality icon, use icon png. See https://pwa.nuxtjs.org/modules/icon.html

console.warn('You are using a low quality icon, use icon png. See https://pwa.nuxtjs.org/modules/icon.html')

@pi0
Copy link
Member

pi0 commented Aug 16, 2020

@liyasthomas It should only happen if you disabled icon or only having favicon.ico. Would you please share nuxt.config and directory structure (screen shot of static or assets) with a new bug report issue?

@liyasthomas
Copy link
Author

Here's my screenshot of static folder.

Screenshot (2)

And my nuxt.config.js

  pwa: {
    meta: {
      ogHost: process.env.BASE_URL,
      twitterCard: 'summary_large_image',
      twitterSite: options.social.twitter,
      twitterCreator: options.social.twitter,
      description: options.shortDescription,
      theme_color: options.app.background,
    },
    manifest: {
      name: options.name,
      short_name: options.name,
      description: options.shortDescription,
      start_url: '/',
      background_color: options.app.background,
      theme_color: options.app.background,
    },
  },

@pi0
Copy link
Member

pi0 commented Aug 16, 2020

This error should be only happening if there is no icon.png file. Can you please somehow share the project issue is happening? (and opening new issue would be appreciated since it is not related to maskable icons)

@zorca
Copy link

zorca commented Aug 20, 2020

This error should be only happening if there is no icon.png file. Can you please somehow share the project issue is happening? (and opening new issue would be appreciated since it is not related to maskable icons)

This error has been appearing for some time on every fresh Nuxt project. The icon.png file is located in the static folder.

@liyasthomas
Copy link
Author

Raised a question here: https://cmty.app/nuxt/pwa-module/issues/c238

@thiscodes4u
Copy link

Having this very same issue. Latest Nuxt/PWA installed. The project structure looks like this:

"@nuxtjs/pwa": "^3.0.2",
"nuxt": "^2.14.4"
static
├── README.md
├── favicon.ico
├── icon.png
├── share-image.jpg
├── sw.js
└── videos

PWA using defaults settings in nuxt.config.js

modules: [
    // Doc: https://pwa.nuxtjs.org/
    '@nuxtjs/pwa',
  ],

@pi0
Copy link
Member

pi0 commented Sep 1, 2020

Regarding low quality warning, i've created #341 and will check soon (seems related to #25 not maskable feature). Please use proper thread :)

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

No branches or pull requests