Skip to content

Commit ede906c

Browse files
fix: bundle the toolbar logo so it survives the production build
The logo was referenced by a runtime string (src="assets/lp5-logo.svg"), which Vite does not copy into dist/, so it 404s on the deployed site. Import the SVG instead so Vite bundles it (inlined as a data URI). Add src/vite-env.d.ts to type the asset import.
1 parent b094333 commit ede906c

2 files changed

Lines changed: 3 additions & 1 deletion

File tree

‎src/ui/app.ts‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import { escapeHtml, renderMarkdown, showModal, type ModalSpec } from './dialog'
1919
import { formatVisitorCount, startVisitorCounter } from './visitor-counter';
2020
import { getLocale, LOCALES, localizeLevel, localizeSequence, setLocale, ui } from '../i18n';
2121
import type { Locale } from '../i18n';
22+
import brandLogoUrl from '../../assets/lp5-logo.svg';
2223

2324
const REPO_URL = 'https://github.com/alisadeghiaghili/learn-python';
2425
const COFFEE_URL = 'https://www.buymeacoffee.com/alisadeghil';
@@ -175,7 +176,7 @@ export class App {
175176
<div class="app-main">
176177
<header class="toolbar">
177178
<a class="brand" href="./" aria-label="learnpython home">
178-
<img class="brand-logo" src="assets/lp5-logo.svg" width="22" height="22" alt="" />
179+
<img class="brand-logo" src="${brandLogoUrl}" width="22" height="22" alt="" />
179180
<span class="brand-text">learn<span class="brand-accent">python</span></span>
180181
</a>
181182
<div class="level-title" id="level-title"></div>

‎src/vite-env.d.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/// <reference types="vite/client" />

0 commit comments

Comments
 (0)