serve: Build your lesson and work on it at the same time

View source: R/serve.R

serveR Documentation

Build your lesson and work on it at the same time

Description

This function will serve your lesson and it will auto-update whenever you save a file.

Usage

serve(path = ".")

Arguments

path

the path to your lesson. Defaults to the current path.

Details

sandpaper::serve() is an entry point to working on any lesson using The Carpentries Workbench. When you run this function, a preview window will open either in RStudio or your browser with an address like localhost:4213 (note the number will likely be different). When you make changes to files in your lesson, this preview will update automatically.

When you are done with the preview, you can run servr::daemon_stop().

Value

the output of servr::httw(), invisibly. This is mainly used for its side-effect

See Also

build_lesson(), render the lesson once, locally.

Examples

if (FALSE) {
 # create an example lesson
 tmp <- tempfile()
 create_lesson(tmp, open = FALSE)

 # open the episode for editing
 file.edit(fs::path(tmp, "episodes", "01-introduction.Rmd"))

 # serve the lesson and begin editing the file. Watch how the file will
 # auto-update whenever you save it.
 sandpaper::serve()
}

zkamvar/sandpaper documentation built on March 18, 2023, 7 a.m.