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

Optional icon generator by generateIcons option #196

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Commits on Nov 8, 2024

  1. Optional favicon generator by generateFavicons option

    The reason for this commit is that I use another custom generator for
    favicons (it generates PNGs from an SVG with a custom filename).
    Because of this, when esbuild-plugin-html tries to load the favicons
    referred URLs, it fails with the following error:
    
    ```
    ✘ [ERROR] Failed to resolve icon path: assets/icon-dark-196x196.png [plugin html]
    
    ✘ [ERROR] Failed to resolve icon path: assets/icon-dark-196x196.png [plugin html]
    
    [build][resources][manifests]: 25.672ms
    Error: Build failed with 2 errors:
    error: Failed to resolve icon path: assets/icon-dark-196x196.png
    error: Failed to resolve icon path: assets/icon-dark-196x196.png
        at failureErrorWithLog (node_modules/esbuild/lib/main.js:1472:15)
        at node_modules/esbuild/lib/main.js:945:25
        at node_modules/esbuild/lib/main.js:1353:9
        at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
      errors: [Getter/Setter],
      warnings: [Getter/Setter]
    }
    [build]: 30.824ms
    [build][resources][assets]: 38.637ms
    ```
    
    Therefore, to ignore these errors, I added the build option
    `generateFavicons` as a flag for the `collectIcons`.
    
    The default value is `true`, so its behavior will be the same as
    always.
    
    I added a test for `generateFavicons` set to `false`.
    
    Signed-off-by: José Luis Salvador Rufo <[email protected]>
    jlsalvador committed Nov 8, 2024
    Configuration menu
    Copy the full SHA
    bbc6195 View commit details
    Browse the repository at this point in the history