diff --git a/frontend/themes/asf/favicon.png b/frontend/themes/asf/favicon.png
new file mode 100644
index 0000000..18d070a
Binary files /dev/null and b/frontend/themes/asf/favicon.png differ
diff --git a/frontend/themes/asf/favicon.svg b/frontend/themes/asf/favicon.svg
deleted file mode 100644
index d6d2fc8..0000000
--- a/frontend/themes/asf/favicon.svg
+++ /dev/null
@@ -1,4 +0,0 @@
-
diff --git a/frontend/themes/resolveTheme.ts b/frontend/themes/resolveTheme.ts
index fdd0457..de82980 100644
--- a/frontend/themes/resolveTheme.ts
+++ b/frontend/themes/resolveTheme.ts
@@ -38,7 +38,7 @@ export function resolveTheme(name: string | undefined, dir: string = THEMES_DIR)
);
}
- const favicon = path.join(dir, trimmed, 'favicon.svg');
+ const favicon = path.join(dir, trimmed, 'favicon.png');
return {
css: path.join(dir, trimmed, 'theme.css'),
favicon: fs.existsSync(favicon) ? favicon : null,
diff --git a/frontend/vite.config.ts b/frontend/vite.config.ts
index 6606552..61e8cdd 100644
--- a/frontend/vite.config.ts
+++ b/frontend/vite.config.ts
@@ -17,20 +17,21 @@ function themeFor(mode: string) {
* Build emits it as an asset; the dev server serves it from the theme folder.
*/
function themeFavicon(faviconPath: string | null): Plugin {
- const publicName = 'favicon-theme.svg';
+ const publicName = 'favicon-theme.png';
return {
name: 'cms-theme-favicon',
// 'post': Vite has already prefixed the base path (/admin/) by then, so match any prefix.
transformIndexHtml: {
order: 'post',
handler(html) {
- return faviconPath === null ? html : html.replace(/href="([^"]*)favicon\.svg"/, `href="$1${publicName}"`);
+ return faviconPath === null ? html : html.replace(/]*favicon\.svg"[^>]*>/, (tag) =>
+ tag.replace(/type="[^"]*"/, 'type="image/png"').replace(/href="([^"]*)favicon\.svg"/, `href="$1${publicName}"`));
},
},
configureServer(server) {
if (faviconPath === null) return;
server.middlewares.use(`/${publicName}`, (_req, res) => {
- res.setHeader('Content-Type', 'image/svg+xml');
+ res.setHeader('Content-Type', 'image/png');
res.end(fs.readFileSync(faviconPath));
});
},