slidev icon indicating copy to clipboard operation
slidev copied to clipboard

Persisted drawings aren't exported to PDF nor hosted site

Open adrianbienias opened this issue 3 years ago • 1 comments

Describe the bug Despite the following setting

drawings: 
  persist: true

Drawings aren't exported to PDF nor static site.

From the docs, I understand that it should be possible

The following frontmatter configuration allows you to persist your drawings as SVGs under .slidev/drawings directory and have them inside your exported pdf or hosted site.

https://sli.dev/guide/drawing.html#persist-drawings

To Reproduce Steps to reproduce the behavior:

  1. Create a project $ npm init slidev
  2. Change drawings config in slides.md to
drawings:
  persist: true
  1. Run the $ slidev
  2. Draw something on slides
  3. Confirm that drawings were saved in .slidev/drawings
  4. Install playwright-chromium https://sli.dev/guide/exporting.html#exporting
  5. Export slides to PDF $ slidev export
  6. See that there are no drawings on exported slides

Desktop (please complete the following information):

  • Slidev version: 0.35.5

adrianbienias avatar Aug 23 '22 11:08 adrianbienias

I am also having this problem when running npm run build to compile the presentation to host on my website. When I do this the drawings are absent. There are no errors or warnings in the browser console.

lpil avatar Aug 25 '22 13:08 lpil

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Oct 24 '22 15:10 stale[bot]

Hi robot! Please keep this open.

lpil avatar Oct 24 '22 15:10 lpil

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Dec 23 '22 18:12 stale[bot]

Hi robot, please keep this open.

lpil avatar Dec 23 '22 19:12 lpil

I pushed a PR to fix the exports of the drawings. While exporting we still use the Vite server and thanks to the vite-plugin-vue-server-ref plugin we can get the saved drawings and display them.

But if you build your project, you will only have static files, so we can't retrieve nor save the drawings on the file system. If you build with drawings.persist=true the drawings you made using the static build we be saved in your browser local storage. So if you quit the page and then reopen it, you should be able to retrieve your drawings.

tonai avatar Jan 16 '23 15:01 tonai