Appearance
Images
Templates use two kinds of images:
| Kind | Where | Shipped as files? | How to replace |
|---|---|---|---|
| Local images | src/assets/ (often src/assets/gen/) | Yes, they are yours to use | Replace the file with one of the same name, or import a new file |
| Unsplash photos | IDs in src/shared/images.js, src/lib.js or src/data/photos.js | No, loaded by URL from Unsplash | Change the ID, or switch to your own local file |
Local images
Local images are imported in code, so Vite optimises them and adds a content hash to the file name when you build:
js
import hero from './assets/gen/hero.webp'
import story from './assets/gen/story.webp'WebP with a fallback
Every local photo comes as a pair with the same name:
hero.webp: the light file every modern browser uses;hero.jpg(photos) orhero.png(cut-outs with a transparent background): the fallback.
A small helper (src/shared/imageFallback.js, started from src/main.jsx) switches an image to its fallback if the WebP can't be shown.
Replace both files of a pair
If you replace only hero.jpg, modern browsers keep showing the old hero.webp. Always export and replace both files, with the same name.
Replace a local image in place
The quickest way. No code changes.
- Find the file in
src/assets/.prompts/IMAGE-PROMPTS.mdlists every image with its path, size and where it appears. - Prepare your new image at the same pixel size and aspect ratio (see exporting at the right size).
- Save it as WebP and JPG (or PNG for transparent cut-outs) with exactly the same file names, lower case included.
- Overwrite the old files. The dev server reloads. If the old image still shows, hard-refresh with Ctrl + Shift + R.
Add a new local image
js
import myTeam from './assets/team-photo.webp'jsx
<img src={myTeam} alt="Our team at the Dar es Salaam office" loading="lazy" />If you want a fallback, save team-photo.jpg next to it; the helper finds it by name.
Unsplash photos
Photos from Unsplash are referenced by their photo ID and loaded from Unsplash's CDN. The img() helper in src/shared/images.js builds the URL:
js
export const img = (id, w = 1200) =>
String(id).startsWith('photo-')
? `https://images.unsplash.com/${id}?auto=format&fit=crop&w=${w}&q=80`
: id
export const photos = {
whiteVillaPool: 'photo-1613977257363-707ba9348227',
livingBright: 'photo-1600607687939-ce8a6c25118c',
}Content then uses them like this: img(p.whiteVillaPool, 700) (the number is the width requested from the CDN).
Why Unsplash photos are links, not files
The Unsplash licence lets you use photos on your website for free, but does not allow redistributing them as files. So we keep them as links and never put them in your ZIP. They work on your live site, and you can replace them whenever you like.
Swap an Unsplash photo for another one
- Find a photo on unsplash.com and open it.
- Right-click the large image → Copy image address. The URL contains the ID:
https://images.unsplash.com/photo-1600585154340-be6161a56a0c?...→photo-1600585154340-be6161a56a0c. - Replace the ID in the photo map.
Use your own file instead
img() returns anything that isn't an Unsplash ID unchanged, so you can drop an imported file straight into the photo map:
js
import { photos as sharedPhotos } from './shared/images.js'
import ourOffice from './assets/our-office.webp'
export const photos = {
...sharedPhotos,
livingBright: ourOffice, // every place that used livingBright now shows your photo
}For a real business, replacing stock photos with your own (or with images made from the image prompt pack) is the single biggest improvement you can make.
Images in public/
Files in public/ are copied to the site root without processing. Use it for files that need a fixed URL: favicon, Open Graph image, robots.txt. Reference them with relative paths (./og-image.jpg). For images shown on the page, prefer src/assets/, which Vite optimises and caches better.
Performance tips
- Keep large photos around 1600 px wide at most, and under about 300 KB as WebP.
- Use
loading="lazy"on images below the first screen. - Always write a meaningful
alttext. It helps accessibility and SEO.