Persisted drawings aren't exported to PDF nor hosted site
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:
- Create a project
$ npm init slidev - Change drawings config in slides.md to
drawings:
persist: true
- Run the
$ slidev - Draw something on slides
- Confirm that drawings were saved in
.slidev/drawings - Install
playwright-chromiumhttps://sli.dev/guide/exporting.html#exporting - Export slides to PDF
$ slidev export - See that there are no drawings on exported slides
Desktop (please complete the following information):
- Slidev version:
0.35.5
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.
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.
Hi robot! Please keep this open.
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.
Hi robot, please keep this open.
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.