slidevjs / slidev

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

Images from the image-left / image-right are not getting bundled for static hosting #1361

Closed alexandruradovici closed 5 months ago

alexandruradovici commented 7 months ago

Describe the bug When using the imag-left or image-right layout, the image specified in the image parameter is not bundled for static hosting and is not exported to pdf. There is no error displayed (by the build system) if the image filename or path is wrong (it points to a file that does not exists).

To Reproduce Steps to reproduce the behavior:

  1. Write a slide using the image-right template.
  2. Copy a file named image.png into a folder called images that is in the current slide's folder.
  3. Use the image for the image tag: image: /images/image.png.
  4. Build for static hosting
  5. The image is not copied and is not displayed.

The image is displayed is displayed in development mode.

Desktop (please complete the following information):

KermanX commented 7 months ago

As a workaround, you can use the public directory here:

Store the image in /public/images/image.png folder, and set image: /images/image.png in the frontmatter.

antoniomtz commented 7 months ago

the workaround worked for me

yedidyar-ni commented 1 month ago

also worked for me. Thanks!

vorburger commented 1 week ago

This also affects layout: image, e.g. something like this:

---
layout: image
image: images/wordcloud.svg
----

I had initially worked (hacked) around this using a ln -s ../images/ dist/images; but moving image/* into a new created public/ is a better solution.

Perhaps the default MD starter generated by npm init slidev@latest could illustrate this and include a public/image/example.png kind of illustration?