Hi, I've got a shiny application build with the dashboard package that I'd like to embed into a markdown document.
I've written some simple code that allows me to add "?embed=true" to the querystring of the shiny app which in turn adds an "embed.css" stylesheet to remove the menus and change some styling to make it fit better in the book.
So in UI I've got:
dashboardBody(
uiOutput('embedStylesheet'),
blah...
)
And in server at the very top I've got:
output$embedStylesheet = renderUI({
query = getQueryString()
if("embed" %in% names(query) && query["embed"] == "true")
{
tags$head(tags$link(rel = "stylesheet", type = "text/css", href = "css/embed.css"))
}
})
However, the problem I'm facing is that there's about a 2 second delay before the serverside script is being run, and as such you get a "flash" of the full dashboard layout that I'd like to avoid.
Can anyone suggest where I can move my code in the execution pipeline to ensure that this stylesheet is getting added to the DOM as early as possible?
Cheers,
Roy