NJAldwin / eleventy-plugin-gen-favicons

Favicon generator plugin for eleventy
MIT License
15 stars 4 forks source link

Error with Nunjucks shortcode `favicons` (via Template render error) #3

Closed Tundra-bit closed 1 year ago

Tundra-bit commented 1 year ago

Hi, First off , thanks for your work on this plugin.

Not sure if this is related to the the recent changes to png-to-ico. Last night I started getting this issue coincidentally after I installed eleventy-plugin-sharp-respimg So, I removed eleventy-plugin-sharp-respimg, but still getting a stack trace: Error.

Re-installed eleventy-plugin-gen-favicons, but my previous working setup is now repeatedly failing.

My favicon is a square.svg

Here are some of the details - not much and removed many useless characters:

[11ty] Problem writing Eleventy templates: (more in DEBUG output)
[11ty] 1. Having trouble writing template: "_site/index.html" (via EleventyTemplateError)
[11ty] 2. (./src/_includes/default.html)
[11ty]   Template render error: (/opt/eleventy/src/_includes/partials/favicon.html)
[11ty]   EleventyShortcodeError: Error with Nunjucks shortcode `favicons` (via Template render error)
[11ty] 3. �PNG
[11ty] 
IHDR@�iq�       pHYs��b3y!IDATx��[{�TU?sνwvfg�vWw]��Qh%�!��m` R�P��s��>�K��KӈjK�A���EEC)� 
[11ty] �j�&:    �/
                  K����
[�Ő�]�%d>y+t�}I�+�\r�����?�\����<2�    N^'oİ$>�鷘\��A��U�b�X���a�����IEND�B`� is not or a valid PNG file. (via Template render error)
[11ty] 
[11ty] Original error stack trace: Error: �PNG
                                                                                                                                                        \��A��U�b�X���a�����IEND�B`� is not or a valid PNG file.
[11ty]     at /opt/eleventy/node_modules/png-to-ico/lib/png.js:12:10
[11ty]     at async Promise.all (index 0)
[11ty]     at async Promise.all (index 0)
[11ty]     at async module.exports (/opt/eleventy/node_modules/eleventy-plugin-gen-favicons/favicon-gen.js:87:5)
[11ty]     at async Object.<anonymous> **(/opt/eleventy/node_modules/eleventy-plugin-gen-favicons/index.js:25:28)**

My .eleventy.js favicon config:

  eleventyConfig.addPlugin(faviconsPlugin, {
    outputDir: "./_site",
    manifestData: { name: "Acme Inc" },
  });

/opt/eleventy/src/_includes/partials/favicon.html

{% favicons "./src/static/img/favicon.svg", appleIconBgColor='#FFF' %}

Thanks.

NJAldwin commented 1 year ago

@Tundra-bit thank you for the detailed report. I will see if I can reproduce this.

If you get a chance, can you list the output of npm ls --all? I want to make sure I'm using the right versions to repro.

NJAldwin commented 1 year ago

@Tundra-bit I did a bit of testing but haven't yet been able to reproduce this.

I did just release version 1.1.1 which should resolve the audit issues from #2 -- if you could bump that and give it a try, that could be helpful. You may want to try running npm update --save to update all dependencies, this library included, and see whether that helps :)

NJAldwin commented 1 year ago

It has been a couple of months, any update on whether this is still an issue @Tundra-bit ? I still haven't been able to repro, so I am likely to close this soon; please reopen if it's still a problem, and hopefully we can figure it out.

Tundra-bit commented 1 year ago

Hi, Thanks for the updates. Sorry for the late reply. You can close this. In the end I reinstalled the stack and It seemed to work, and went forward with the project. I must have missed your emails.

All the best to you in your endeavors.