Open muellerzr opened 1 year ago
I haven't taken a look at how the output, but there's a lot of dynamically loaded stuff (wasm files, wheels, and others), and unfortunately, I don't think it will be possible to embed all those resources into the page -- I don't even know how quarto would be able to know about them, since some of the files (like wheels) are only known about at run time.
No worries. Could it be possible to raise an error if that's being set?
I think that probably can be done, but I'll have do a bit of investigation to figure out how.
That'd be great if so, otherwise this issue also can act as a quick find for folks that try the same thing 😅
I recommend writing this as a prerequisite in the Readme file
Any updates on this?
I'm trying to do the exact same thing, but as @wch said above , it sounds like it's not possible to create a completely self-contained HTML file that contains a shinylive codeblock?
The idea of raising an error sounds good, then it at least gives the user some more information that it won't work.
It turns out that shinylive's Lua filter won't have access to the embed-resources
option and therefore we can't detect that embed-resources: true
is set to be able to throw an error. Quarto may add that to the metadata it passes to the Lua filters in the future, in which case we can throw early.
In the mean time, I've come up with a hacky but workable solution. When shinylive is used with embed-resources: true
, the original code chunk is shown in full instead of the shinylive app.
So we can add some warning code to the top of the code chunk that only shows up when shinylive fails to load. The top of the code chunk always contains the chunk options, so we need to use the same syntax:
#| '!! shinylive warning !!': |
#| shinylive does not work in self-contained HTML documents.
#| Please set `embed-resources: false` in your metadata.
Hopefully this gives enough information to the person with the broken output to figure out what's going wrong.
Hi all!
Love the project :)
Hit a fun snag when I was getting a recent blog up and going where if
embed-resources:true
is set in my_quarto.yml
, shinylive just won't render!Minimal repr:
YAML:
somepage.qmd
: