-
-
Notifications
You must be signed in to change notification settings - Fork 6.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(html): skip inlining icon and manifest links #14958
Conversation
Co-authored-by: 翠 / green <green@sapphi.red>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💚
/ecosystem-ci run |
📝 Ran ecosystem CI on
|
Why did you remove this feature rather than add an option to the configuration? |
Can you explain why you need the old behaviour? The previous behaviour was a bug. |
I am developing a web configurator for an embedded device. So I don't need a performance for multiple downloads, cashing, etc. Also, I embed the built page in the configurator executable and receive a single file that contains everything. All files that are not inlined separately should be processed on the side of my configurator. So, it just adds work on my side. |
Thanks for explaining your usecase. Since it isn't Vite's main target audience, I think the PR still make sense. It'll be beneficial for many websites ootb. That means you're required to inline the favicon yourself in this case. Vite will only add options when really only needed: https://vitejs.dev/guide/philosophy.html#lean-extendable-core |
For info if #15366 lands you should be able to overwrite this change (exact implementation still to be discussed) |
Doesn't seem to be able to force inlining. |
Please at least add an option to inline the favicon or provide a trick, this is very import for single file webpage. It worked as what I expected in the earlier version, but now I can't even force it to inline the icon |
You can inline the favicon with a plugin like this: {
name: "inline-favicon",
apply: "build",
enforce: "post",
generateBundle(_, bundle) {
const html = bundle["index.html"] as OutputAsset;
const content = readFileSync("./public/vite.svg");
html.source = (html.source as string).replaceAll(
"/vite.svg",
"data:image/svg+xml;base64," + content.toString("base64"),
);
},
} |
I did write a plugin using cheerio to inline the icon as base64 data manually. I'll try your method. Thanks for the share! |
Description
fix #6741
fix #5962
Don't inline icon and manifest
<link>
s. The above issues explained why, but to summarize:Additional context
I'm also partially working towards supporting
import img from './foo.png?inline=false
(as a poc and we could also further discuss), this is a cutoff point for now to fix those issues.What is the purpose of this pull request?
Before submitting the PR, please make sure you do the following
fixes #123
).