slidevjs / slidev

Presentation Slides for Developers
https://sli.dev
MIT License
31.94k stars 1.26k forks source link

static assets not processed by vite when referenced in the frontmatter of the image-left/image-right default layouts #1707

Closed gureckis closed 1 week ago

gureckis commented 1 week ago

Describe the bug

When building slides that reference static image assets in the front matter (e.g., image-left) the asset is not copied into the final build folder by vite.

Minimal reproduction

  1. create a starter project
  2. create a folder assets/ with photo.png inside
  3. Include a slide with the following front matter
---
layout: image-left
image: assets/photo.png
class: mycoolclass
---
  1. Things display ok in dev mode
  2. build the project using slidev build
  3. photo.png is not copied into assets folder of the dist/ folder
    However, the rendered HTML does reference this file:
<div class="w-full h-full" style="color: white; background-image: url("assets/photo.png"); background-repeat: no-repeat; background-position: center center; background-size: cover;"></div>

I expected that all references static content would be processed by vite and moved into the assets folder.

Environment

gureckis commented 1 week ago

nevermind, this is probably a use case for public/ folder