njaldwin / eleventy-plugin-gen-favicons Goto Github PK
View Code? Open in Web Editor NEWFavicon generator plugin for eleventy
License: MIT License
Favicon generator plugin for eleventy
License: MIT License
oleeskild/digitalgarden#161 (comment)
/opt/build/repo/src/site/_includes/components/pageheader.njk
34
35{% favicons './src/site/favicon.svg', appleIconBgColor='#123' %}
36
6:06:49 PM: [11ty] Template render error: (/opt/build/repo/src/site/_includes/components/pageheader.njk)
6:06:49 PM: [11ty] EleventyShortcodeError: Error with Nunjucks shortcode favicons (via Template render error)
6:06:49 PM: [11ty] 3. Expected number between 1 and 100000 for density but received 0.5625 of type number (via Template render error)
6:06:49 PM: [11ty]
6:06:49 PM: [11ty] Original error stack trace: Error: Expected number between 1 and 100000 for density but received 0.5625 of type number
6:06:49 PM: [11ty] at Object.invalidParameterError (/opt/build/repo/node_modules/eleventy-plugin-gen-favicons/node_modules/sharp/lib/is.js:124:10)
6:06:49 PM: [11ty] at Sharp._createInputDescriptor (/opt/build/repo/node_modules/eleventy-plugin-gen-favicons/node_modules/sharp/lib/input.js:92:18)
6:06:49 PM: [11ty] at new Sharp (/opt/build/repo/node_modules/eleventy-plugin-gen-favicons/node_modules/sharp/lib/constructor.js:341:29)
6:06:49 PM: [11ty] at Sharp (/opt/build/repo/node_modules/eleventy-plugin-gen-favicons/node_modules/sharp/lib/constructor.js:169:12)
6:06:49 PM: [11ty] at resizedSharp (/opt/build/repo/node_modules/eleventy-plugin-gen-favicons/favicon-gen.js:34:10)
6:06:49 PM: [11ty] at /opt/build/repo/node_modules/eleventy-plugin-gen-favicons/favicon-gen.js:41:33
6:06:49 PM: [11ty] at Array.map ()
6:06:49 PM: [11ty] at icoBuf (/opt/build/repo/node_modules/eleventy-plugin-gen-favicons/favicon-gen.js:41:20)
6:06:49 PM: [11ty] at module.exports (/opt/build/repo/node_modules/eleventy-plugin-gen-favicons/favicon-gen.js:92:7)
6:06:49 PM: [11ty] at async Object. (/opt/build/repo/node_modules/eleventy-plugin-gen-favicons/index.js:25:28)
6:06:50 PM: Failed during stage 'building site': Build script returned non-zero exit code: 2 (https://ntl.fyi/exit-code-2)
6:06:49 PM: [11ty] Copied 29 files / Wrote 0 files in 0.42 seconds (v2.0.1)
6:06:49 PM: ERROR: "build:eleventy" exited with 1.
6:06:49 PM:
6:06:49 PM: "build.command" failed
6:06:49 PM: ────────────────────────────────────────────────────────────────
first of all: thanks a lot for this plugin!
when installing it via npm, it gives a warning for 6 high severity vulnerabilities.
i'll probably use it anyway, but maybe it would be a good idea to fix them at some stage :)
Hi there! Thank you for this plugin :)
Is there a chance to add support for multiple manifests?
I have this structure of my _data/meta.js
:
require('dotenv').config()
module.exports = {
env: process.env.NODE_ENV,
url: process.env.URL || 'http://localhost:8080',
en: {
title: 'title',
description: 'description',
},
ru: {
title: 'тайтл',
description: 'описание',
},
}
And with this structure, I don't see any way to provide metadata to manifestData
object to generate multiple manifests and associate them with the corresponding templates. Much appreciated for any help!
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.
Hello,
I successfully customized outputdir like this:
outputDir: "./static/assets/img/favicon"
but tags generated are like these:
<link rel="icon" href="/favicon.ico" sizes="any">
<link rel="icon" href="/favicon.svg" type="image/svg+xml">
<link rel="apple-touch-icon" href="/apple-touch-icon.png">
<link rel="manifest" href="/manifest.webmanifest">
is it possible to customize the href path?
thank you
Hi!
First of all, thank you very much for your work. This plugin rocks!
I use it across many projects of mine and I recently was contacted by someone who tried to run my Eleventy template using Windows 10. When I tried reproducing their issue on a Virtualbox machine, I started getting an error Error: EBUSY: resource busy or locked: [path to favicon.svg here]
I can't reproduce it anywhere else than Powershell 7 and I'm not sure what's going on there.
I also explained this issue in detail here: lwojcik/eleventy-template-bliss#91
Any ideas?
I'm unable to pass arguments in the shortcode. I'm using liquid, but also tried njk.
Error:
Problem writing Eleventy templates: (more in DEBUG output)
[11ty] 1. Having trouble writing template: "_site/components/index.html" (via EleventyTemplateError)
[11ty] 2. invalid syntax at line 1 col 25:
[11ty]
[11ty] favicon appleIconBgColor='blue'
[11ty] ^, file:C:\Users\silve\websites\11ty\starters\11ty-cloudcannon-starter\src\_includes\head.liquid, line:35, col:5 (via RenderError)
[11ty] 3. invalid syntax at line 1 col 25:
[11ty]
[11ty] favicon appleIconBgColor='blue'
[11ty] ^ (via Error)
[11ty]
[11ty] Original error stack trace: Error: invalid syntax at line 1 col 25:
[11ty]
[11ty] favicon appleIconBgColor='blue'
[11ty] ^
[11ty] at Lexer._token (C:\Users\silve\websites\11ty\starters\11ty-cloudcannon-starter\node_modules\moo\moo.js:533:13)
[11ty] at Lexer.next (C:\Users\silve\websites\11ty\starters\11ty-cloudcannon-starter\node_modules\moo\moo.js:480:19)
[11ty] at Function.parseArguments (C:\Users\silve\websites\11ty\starters\11ty-cloudcannon-starter\node_modules\@11ty\eleventy\src\Engines\Liquid.js:121:21)
[11ty] at async Object.render (C:\Users\silve\websites\11ty\starters\11ty-cloudcannon-starter\node_modules\@11ty\eleventy\src\Engines\Liquid.js:145:26)
[11ty] at async TemplateLayout.render (C:\Users\silve\websites\11ty\starters\11ty-cloudcannon-starter\node_modules\@11ty\eleventy\src\TemplateLayout.js:161:25)
[11ty] at async Template.renderPageEntry (C:\Users\silve\websites\11ty\starters\11ty-cloudcannon-starter\node_modules\@11ty\eleventy\src\Template.js:853:17)
[11ty] at async C:\Users\silve\websites\11ty\starters\11ty-cloudcannon-starter\node_modules\@11ty\eleventy\src\Template.js:883:21
[11ty] at async Promise.all (index 0)
[11ty] at async Promise.all (index 1)
[11ty] at async Eleventy.executeBuild (C:\Users\silve\websites\11ty\starters\11ty-cloudcannon-starter\node_modules\@11ty\eleventy\src\Eleventy.js:1003:13)
[11ty] Wrote 0 files in 0.05 seconds (v1.0.1)
Hey there,
Thanks for making this plugin!
I'm having an issue.
From what I can tell, the issue is that the plugin cannot find the svg file.
I can see that the image is in my _site/img
directory at build.
I'm using the eleventy-base-blog template, which uses .njk template files.
I've followed the installation instructions to the T, twice, from the npmjs.com page, and gotten the same issue.
This is the line I've put at the end of the <head>
section in my base.njk
template file:
{% favicons "/img/favicon.svg" %}
I've tried formatting it as:
{% favicons "favicon.svg" %}
{% favicons "/favicon.svg" %}
{% favicons "./favicon.svg" %}
{% favicons "/img/favicon.svg" %}
{% favicons "./img/favicon.svg" %}
I've tried using '
quotes and "
quotes.
I've tried renaming it favicon_0001.svg
I've tried loading .png version of the file.
So far, nothing works.
This is the error message that comes up when I try to build:
[11ty/eleventy-base-blog] Excluding drafts.
[11ty] Writing _site/sitemap.xml from ./content/sitemap/sitemap.xml.njk
[11ty] Writing _site/feed/feed.json from ./content/feed/json.njk
[11ty] Writing _site/feed/feed.xml from ./content/feed/feed.njk
[11ty] Problem writing Eleventy templates: (more in DEBUG output)
[11ty] 1. Having trouble writing to "_site/contact/index.html" from "./content/contact.md" (via EleventyTemplateError)
[11ty] 2. (./_includes/layouts/base.njk)
[11ty] EleventyShortcodeError: Error with Nunjucks shortcode `favicons` (via Template render error)
[11ty] 3. ENOENT: no such file or directory, stat '/img/favicon.svg' (via Template render error)
[11ty]
[11ty] Original error stack trace: Error: ENOENT: no such file or directory, stat '/img/favicon.svg'
[11ty] Copied 45 files / Wrote 0 files in 1.31 seconds (v2.0.1)
Any ideas?
Thank you,
Liam
I notice working on a website that this plugin produced out of proportion apple icons and found the recommendation from Evil Martians to add a 20px padding but I believe this is a general guideline. They don't follow this themself: https://evilmartians.com/apple-touch-icon.png
Would it be possible to add an option for controlling the amount of padding? From no padding to 20px for example.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.