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


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


serve(path = ".")



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


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().


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

See Also

build_lesson(), render the lesson once, locally.


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.

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