Spomky-Labs / pwa-bundle

PHP library for generating a full featured PWA manifest

Home Page:https://pwa.spomky-labs.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Intelligent Icon creator command

Spomky opened this issue · comments

Description

As per discussion here: #100 (reply in thread)

Example

No response

Icon mgmt is a bit boring....
The user shall:

  • Use the command to generate icons at the correct size
  • Copy / Paste the output and indent correctly in the correct section

Repeat for the application or each shortcut.

# Configuration (today)
pwa:
    manifest:
        ...
        icons:
            - src: "icons/logo.svg"
              sizes: [0]
            - src: "icons/logo_48x48.png"
              sizes: [48]
            - src: "icons/logo_96x96.png"
              sizes: [96]
            - src: "icons/logo_144x144.png"
              sizes: [144]
            - src: "icons/logo_180x180.png"
              sizes: [180]
            - src: "icons/logo_256x256.png"
              sizes: [256]
            - src: "icons/logo_512x512.png"
              sizes: [512]

This could be drastically simplified by formatting/converting the files during the compilation time

# Expected configuration
pwa:
    manifest:
        ...
        icons:
            - src: "icons/logo.svg"
              formats:
                  # Tuples format: sizes
                  svg: [0]
                  png: [48, 96, 144, 180, 256, 512]

During the compilation, the bundle should:

  • Create the icons at the expected sizes and formats
  • Populate the manifest accordingly

For dev/test, the images are not converted and formats are merged.
The browser will moan about that in these envs, but not in production.

When done, this will be on a similar way for #66

Great idea.

I was also playing around with generating screenshots as a separate yaml file and importing it in the main pwa.yaml. That is

# pwa.yaml

imports:
    - screenshots.yaml

Then the screenshots.yaml file can be independently maintained. I've been playing around with a screenshot generator using zenstruck/browser, because it handles the authentication so easily. The screen size options are still a bit clunky, though.

I think we could get rid of symfony/panther or zenstruck/browser by using screen capture API. From the profiler footes bur (maybe?).

Hmm, interesting. I'm not familiar with how to use that, especially from the command line.

I like the idea of having a utility that automates the screen captures into a script.