mirror of
https://gitlab.com/soapbox-pub/shakespeare.git
synced 2026-12-06 00:27:24 +00:00
Fix public asset paths for Electron compatibility
The issue: With base: './' for Electron, absolute paths like /shakespeare.svg don't work because they resolve to filesystem root in file:// protocol. The solution: Import assets so Vite transforms paths at build time. - import logo from '/shakespeare.svg' (without ?url) - Vite automatically converts to './shakespeare.svg' with base: './' - Works in both browser and Electron This is cleaner than ?url suffix which is unnecessarily Vite-specific. Fixed components: - ShakespeareLogo: import shakespeareLogo from '/shakespeare.svg' - AppShowcaseCard: import badgeSvg from '/badge.svg' Added PUBLIC_ASSETS_EXPLANATION.md documenting the solution.
This commit is contained in:
3 files changed
+92
-2
No files matched your search
@@ -2,6 +2,7 @@ import React, { useState } from 'react';
|
||||
import { Link } from 'react-router-dom';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { Card, CardContent } from '@/components/ui/card';
|
||||
import badgeSvg from '/badge.svg';
|
||||
import {
|
||||
ExternalLink,
|
||||
Edit,
|
||||
@@ -567,7 +568,7 @@ export function AppShowcaseCard({ app, onEdit, showModerationControls, hideAppro
|
||||
className="flex-1"
|
||||
>
|
||||
<img
|
||||
src="/badge.svg"
|
||||
src={badgeSvg}
|
||||
alt="Edit with Shakespeare"
|
||||
className="h-6 hover:opacity-80 transition-opacity"
|
||||
/>
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
import shakespeareLogo from '/shakespeare.svg';
|
||||
|
||||
export interface ShakespeareLogoProps {
|
||||
className?: string;
|
||||
}
|
||||
@@ -5,7 +7,7 @@ export interface ShakespeareLogoProps {
|
||||
export function ShakespeareLogo({ className }: ShakespeareLogoProps) {
|
||||
return (
|
||||
<img
|
||||
src="/shakespeare.svg"
|
||||
src={shakespeareLogo}
|
||||
alt="Shakespeare"
|
||||
className={className}
|
||||
/>
|
||||
|
||||
Reference in new issue
Block a user