Open LarsFlieger opened 1 month ago
Thank you Lars for the detailed request! I'm a Next.js dev myself, and the new version of RealFavicon is a Next.js app btw.
Currently RealFavicon doesn't follow Next favicon conventions for two reasons:
Although Next supports many favicon-related conventions, it doesn't support all files created by RealFavicon: icons referenced by the web manifest are not covered. Therefore, they cannot be placed into the app
dir. They must be somewhere in public
.
If RealFavicon was to use Next conventions, the instructions would tell to put "most" files in app
and "those other files" in public
. This is not convenient.
Markups created by RealFavicon are tested and the results are published. What about the markups generated by Next? Do they work? Are they similar to the ones generated by RealFavicon? Are they consistent from Next 14 to 15? What'll happen in Next 16? What is their order? (the order used to matter years ago when Firefox didn't take the size
attribute of PNG favicon into account)
The promise of RealFavicon is to give you icons and code that work. Relying on Next conventions would make you walk the last few steps alone, without this guarantee.
Next conventions are helpful when you craft your icons manually: at least, you don't have to type those boring markups thanks to Next. But with RealFavicon, the HTML is not an issue either because it is computed for you.
I don't want to dismiss Next conventions too quickly. When a new dev works on an existing app, he may wonder where the favicon assets are ("why are they not in the app
dir?"), etc.
And, again, as a Next dev myself, I would like to follow these conventions just for the sake of sticking to the rules.
RealFavicon instructions for Next.js are what they are because they are pragmatic. They are easy to follow, and your favicon will work as expected.
Yet, I would be glad to reconsider if there was a way to work around the issues above.
@phbernard Thanks for your comments! I totally understand your perspective.
However, since many developers use these file conventions, could we consider adding this feature as an optional extension? It wouldn’t alter the core tool but would provide an “include app directory files” option, supporting those following Next.js file structures. This way, the tool stays consistent but also supports Next.js users. Right now, many end up renaming files manually, which could be simplified with this extra feature.
Support both ways? Yep, that could work! Thank you @LarsFlieger for the proposal.
Support both ways? Yep, that could work! Thank you @LarsFlieger for the proposal.
Yes, exactly. We could also integrate a link to RealFaviconGenerator in the Next.js docs to help others create favicons more efficiently.
Description
With the introduction of the new App Router in Next.js (since version 13), Next.js has adopted a convention where placing files with specific names directly into the
app
directory allows the framework to automatically include the correct HTML code for favicons and metadata. This simplifies the process by eliminating the need to manually insert HTML tags for favicons.Currently, RealFaviconGenerator does not support this convention.
It generates favicon files and accompanying HTML code that don't align with Next.js's new file naming requirements, making it less seamless for developers using the latest Next.js versions.
Problem
<head>
tag, which is not necessary with Next.js's new approach.Expected Behavior
app
directory and have Next.js automatically handle them.Actual Behavior
Proposed Solution
favicon.ico
,icon.png
,apple-touch-icon.png
).app
directory to leverage automatic inclusion.References
Additional Context
Supporting Next.js's new conventions would greatly enhance the developer experience for those using RealFaviconGenerator in conjunction with Next.js. It would streamline the favicon setup process and ensure compatibility with modern web development practices.
Thank you for considering this feature request!