Update examples to use bslib #3963
Conversation
…date runExamples() to use that directory by default
|
Looking good to so far! I just changed file locations around a bit for better backwards-compatibility reasons. I also suggested a couple small tweaks, and left them unresolved in case you need to make updates elsewhere |
gadenbuie
left a comment
There was a problem hiding this comment.
Looks great thanks everyone!
I'd love to see us use consistent and modern code style throughout. I certainly have opinions and am happy to restyle the new examples in a follow up.
In particular, I'd like to follow these rules:
- All arguments to a function are either on the same line or each argument is on a new line.
- Closing braces and parens have the same level of indentation as line containing the opening function call.
# Before
textInput(inputId = "caption",
label = "Caption:",
value = "Data Summary"),
# Input: Selector for choosing dataset ----
selectInput(inputId = "dataset",
label = "Choose a dataset:",
choices = c("rock", "pressure", "cars")),
# After
textInput(
inputId = "caption",
label = "Caption:",
value = "Data Summary"
),
# Input: Selector for choosing dataset ----
selectInput(
inputId = "dataset",
label = "Choose a dataset:",
choices = c("rock", "pressure", "cars")
),Importantly, this code style matches Python's black formatting rules so it's easier for us to be consistent across languages and projects if we follow it.
| legacy <- getOption('shiny.legacy.examples', FALSE) | ||
| examplesDir <- if (isTRUE(legacy)) 'examples' else 'shiny' | ||
| examplesDir <- system_file(examplesDir, package='shiny') |
There was a problem hiding this comment.
@karangattu started working on extending runExample() to other packages in #3917.
That said, while we're here, I think we should do a very light-weight version of that work and add package = "shiny" to runExample()'s parameters.
I'll take that in a follow-up PR.
This PR updates
runExample()to use{bslib}-powered examples. These new examples are located underinst/shinyinstead ofinst/examples.To run the old (legacy) examples, set
options(shiny.legacy.examples = TRUE)