question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[gatsby-plugin-manifest] Support SVG favicons

See original GitHub issue

Summary

With modern browsers supporting SVG favicons and dark mode, I was experimenting using with the prefers-color-scheme media query inside an SVG file. While this works fine, gatsby-plugin-manifest currently provides no option to make use of this trick – all images are converted to PNG. A prefer_svg (or prefer_svg_favicon) option in gatsby-plugin-manifest would give users an option to go with that simple solution.

Motivation

To provide the optimal experience for users with visual impairments, serving an SVG with prefers-color-scheme media query can is a simple solution. I understand that performance is one of the driving factors of Gatsby, but not only can a single SVGs be smaller than a PNG. Any workaround to provide the same experience involves extra-code and providing two files.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:5
  • Comments:15 (9 by maintainers)

github_iconTop GitHub Comments

5reactions
moonmeistercommented, Jun 25, 2020

Started work on this. ^^

1reaction
RyanPinPBcommented, Jul 28, 2020

Now that I’m getting the .svg file copied to the public folder, I’m having issues with the backup PNG’s replacing/overriding it.

Using Chrome so it should recognize the SVG.

Do I need to set “include_favicon: false” in the gatsby-config.js file in order to stop the pngs from being created and referenced as a backup?

This doesn’t seem to be the intended use for “include favicon”, is it?

after ‘gatsby develop’, if I delete all of the .png files that are created (for backups I guess?) from my .svg, the svg favicon works as planned. But upon the current build (if I don’t manually go in and delete the PNGs), the PNG’s will replace the SVG, not giving me the dark/light mode media queries I’m trying to get w/ my SVG.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Using an SVG Favicon in Gatsby - Jack Warren
Using an SVG favicon in a Gatsby site can be a bit tricky, because it is one of the only times where you...
Read more >
gatsby-plugin-manifest
Configure icons and their generations - Required ·…at least as big as the largest icon being generated (512x512 by default). ·…square (if it's...
Read more >
How to Add a Favicon to a Gatsby Site - Code Concisely
A favicon can be added to your Gatsby site by using gatsby-plugin-manifest plugin. This will take care of generating the favicon in ...
Read more >
How To Configure Favicons Using Gatsby-Plugin-Manifest
Straight out the box, this plugin includes a bunch of goodies beyond the scope of manifest configuration - including both favicon support and ......
Read more >
Gatsby configure favicon with Gatsby manifest - YouTube
Configure Gatsby site for favicon and offline use with gatsby - plugin -manifes and gatsby - plugin -offline---Follow me on: Website/Blog: ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found