Launches an interactive Shiny app for live editing of frontend JavaScript, CSS, and HTML/Markdown/R Markdown. The app allows users to write JS, CSS and HTML, preview the final product, observe the JavaScript console (specifically items printed to the console via console.log()), and download a zip file containing the source files.

repl_example(example = NULL)

repl(
  example = NULL,
  js_repl_only = FALSE,
  theme_app = NULL,
  theme_editor = "textmate",
  autocomplete = c("css", "html"),
  render_dir = NULL,
  options = list(),
  ...
)

repl_js(..., render_dir = NULL)

Arguments

example

The short name of the exercise or example, e.g. ride-share-fares. Alternatively, the path to a folder containing examples or the path to an example file directly. repl_example(example = NULL) opens an interactive browser to select an example, otherwise repl() and repl_js() will open with blank editors.

js_repl_only

When TRUE, the app is simplified to contain only a JavaScript source editor and a console output. repl_js() is an alias to launch repl() with js_repl_only = TRUE.

theme_app

The theme of the app, using shinythemes. See shinythemes::shinytheme() for a list of valid themes.

theme_editor

The theme of the shinyAce source code editors. See shinyAce::getAceThemes() for a list of valid themes.

autocomplete

Ace Editor language modes for which autocomplete will be enabled. One or more of "js", "css", or "html". By default autocomplete is enabled in all but the JavaScript mode. "Disabling" autocomplete here actually doesn't mean disabling all together. Autocomplete will still be available by pressing Ctrl + space.

render_dir

Where to render temporary files, defaults to tempdir()

options

Options passed to shiny::runApp().

...

Arguments passed from repl_js() to repl() or from repl() to shiny::shinyApp().

Value

A shiny app

Functions

  • repl_example: Launch a js4shiny exercise or example using the example slug, or the full filename. If none provided, repl_example() launches an interactive example browser.

Examples for js4shiny workshop

The app was developed for the js4shiny rstudio::conf workshop and can be used to load examples for practicing and learning JavaScript and web development concepts.