elegantapp / pwa-asset-generator

Automates PWA asset generation and image declaration. Automatically generates icon and splash screen images, favicons and mstile images. Updates manifest.json and index.html files with the generated images according to Web App Manifest specs and Apple Human Interface guidelines.
MIT License
2.73k stars 140 forks source link

Is there a way to only output one icon? Also, is there a way to take multiple inputs? #847

Open justingolden21 opened 2 years ago

justingolden21 commented 2 years ago

Is your feature request related to a problem? Please describe. I have multiple icons for pages in my PWA and want to generate one icon each.

Describe the solution you'd like A CLI flag for one single icon. Currently --icon-only generates 3 icons. I have to delete each icon that I don't need before pushing.

Describe alternatives you've considered Deleting the icons and making a very very long script in package.json.

Additional context Currently, the command: pwa-asset-generator static/img/pages/clock.svg static/img/pages/png --icon-only --opaque false takes in clock.svg and generates three icons. This is the smallest number I've got after trying nearly every combination of flags. Also, providing simply pwa-asset-generator static/img/pages/ as a path I was hoping it would read each file, or that I could provide a list of files, eg. .../clock.svg .../stopwatch.svg etc.

My command currently looks like: pwa-asset-generator static/img/pages/clock.svg static/img/pages/png --icon-only --opaque false && pwa-asset-generator static/img/pages/worldclock.svg static/img/pages/png --icon-only --opaque false && pwa-asset-generator static/img/pages/stopwatch.svg static/img/pages/png --icon-only --opaque false and that's just for three pages, can't imagine if I had more. Also, I have to manually select the 6 unnecessary files and delete them. And of course there's a name conflict so it only generates the most recent icons.

So currently, for each page, I edit the script command, run it, copy the one file I need, rename the file, change the script command for the other file name, and so on until all icons are done. Very tedious human work.

Thanks in advance 😄

onderceylan commented 2 years ago

Hey @justingolden21, thanks for your feedback. It's not possible to generate only one icon at the moment.

That will be most likely possible with the next major version of the library which will provide flexibility for the images you need as an output.

Can you please share more details about your use case of using multiple inputs? That can also be considered in the redesign.

justingolden21 commented 2 years ago

Thanks for the reply and for considering that for future releases : )

I have a manifest and shortcuts for each item which contain icons. Those icons are currently SVGs and I like how pwa-asset-manager handles rendering svg icons dynamically and I already use it in my project, so I figured I would use it for this (fairly similar) purpose.

A few ideas for potential ways to input multiple files: