-
-
Notifications
You must be signed in to change notification settings - Fork 997
ui.Rmd as alternative to ui.R for defining shiny UI #1926
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me!
|
With shinyapps.io deployments (not customer installations), the presence of either With customer deployments of Connect, we will need to adjust I'll reach out privately to coordinate this work. |
|
@jjallaire Oh I forgot to mention one minor thing: |
|
@yihui we are going to deprecate the use (or at least the documentation of
the use) of shiny_prerendered so consistency w/ that isn’t critical. Joe
and I tried it
with a dash and underscore but liked the one w/o better (maybe b/c many
shiny derivative packages use that style)
…On Fri, Oct 16, 2020 at 2:13 PM Yihui Xie ***@***.***> wrote:
@jjallaire <https://github.com/jjallaire> Oh I forgot to mention one
minor thing: shiny_rmd is probably a better name than shinyrmd, given
that we have shiny_prerendered.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#1926 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAAZPR44ANA6U7C3ZKJ3Z33SLCEKZANCNFSM4STIIA4Q>
.
|
|
Got you. I just felt a full name |
This PR implements support for defining Shiny UI via a ui.Rmd file as an alternative to ui.R. It takes advantage of the existing
runtime: shiny_prerenderedcapability (which now has a friendlier alias inruntime: shinyrmd), but rather than encouraging use of multiple contexts (e.g.{r context="setup"},{r context="server"}, etc.) it uses the Rmd file strictly for user-interface (you then create a server.R and optionally global.R just like a conventional shiny application).There are a couple of motivations for this:
Some people feel that it would be much easier to teach Shiny to new users if the UI could be created laid out in markdown rather than with
htmltoolstags (this would be especially true if we created Lua filters to access bs4 layouts/components easily from markdown);This enables taking a primarily static Rmd (which may be expensive to render) and adding just a bit of Shiny for interactivity. For example, you could convert a static flexdashboard into a "dynamic" dashboard with a single interactive shiny visualization (but still keep all of the static bits you have).
Here's what the code would look like:
ui.Rmd
server.R
You could run this app with:
Note that b/c we are using shiny prerendered it's also possible to deploy the app on a server and skip the render step (just use the previously built .html file). On RSC, you'd like render on deploy, and then server the rendered app from .html when users visit the app.
@aronatkins This has some changes to
rmarkdown::run()(principally looking for a ui.Rmd file in the same places that we now look for an index.Rmd file -- both work) that we'll want to make work w/ RSC invocation ofrmarkdown::run(). Also note thatruntime: shinyrmdis now an alias forruntime: shiny_prerenderedso anywhere that you are looking specifically for "shiny_prerendered" you'll need to also look for "shinyrmd".@jcheng5 and @wch this does not implement support for auto-reloading of global.R and server.R. I think this is the correct behavior because the ui.Rmd file also not reloaded when it changes. Making global.R and server.R reload would be easy based on similar code you already have in Shiny, but making ui.Rmd re-load / re-render would be pretty tricky as far as I can tell.