Optional icon generator by `generateIcons` 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 generateIcons 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 generateIcons set to false.
🦋 Changeset detected
Latest commit: bbc61955fd746f4753eedf4f4de962831bc9d312
The changes in this PR will be included in the next version bump.
This PR includes changesets to release 1 package
| Name | Type |
|---|---|
| @chialab/esbuild-plugin-html | Patch |
Not sure what this means? Click here to learn what changesets are.
Click here if you're a maintainer who wants to add another changeset to this PR
Hello,
Is there anything I can do to help you accept or review this PR?
Greetings.
Hello @jlsalvador! Sorry for the late reply. If you are still interested in pursuing this PR, could you please rebase and add the same option for the collectScreens method as well?
Changes from V1 to V2:
- Rebased from
main. - Renamed
generateIconstogenerateFavicons.
Hello @jlsalvador! Sorry for the late reply. If you are still interested in pursuing this PR, could you please rebase and add the same option for the
collectScreensmethod as well?
@edoardocavazza I think for collectScreens could be another option. For example, I might not want to generate the favicons but still need the Apple launcher icons. What do you think?
I agree!
Hi again!
Anything left to accept this PR? I thought about collectScreens would be another PR.