The ## file:
header splits the chunk contents into files, so in your example, you're only creating one R/test-shiny.R
file. You'd need something like this for it to work:
```{shinylive-r}
#| standalone: true
#| viewerHeight: 300
## file: R/test-shiny.R
{{< include R/test-shiny.R >}}
## file: app.R
library(shiny)
ui <- fluidPage(
textInput("name", msg1),
textOutput("greeting"),
)
server <- function(input, output, session) {
output$greeting <- renderText({
paste0(msg2, input$name)
})
}
shinyApp(ui, server)
```
shinylive does assume that code that appears before any file headers is app.R
, though, so if you put the Shiny app code first, you wouldn't need the ## file: app.R
bit.
That's true, it was just an example showing how to create multiple files in shinylive.