Skip to contents

Removes the build output directory, clearing all build artifacts.

Usage

clean_shelves(path = ".")

Arguments

path

The collection, or any directory inside it. The directory removed is its build.output-dir, with any staging directories an interrupted build left in .webrarian/.

Value

Invisibly returns the project path (path), called for its side effect of removing the build output directory.

Examples

collection <- file.path(tempdir(), "webrarian-clean-demo")
catalog(collection)
#> ✔ Created directory /tmp/RtmpQU25pJ/webrarian-clean-demo
#> ✔ Created _webrarian.yml
#> ✔ Added "_site/" and ".webrarian/" to .gitignore
#> ✔ Cataloged webrarian collection: "webrarian-clean-demo"
#> 
#> Next steps:
#>   Move into the collection: `setwd("/tmp/RtmpQU25pJ/webrarian-clean-demo")`
#>   Acquire packages: `webrarian::acquire_package("dplyr")`
#>   Acquire files: `webrarian::acquire_file("data/")`
#>   Bind: `webrarian::bind()`
#>   Reading room: `webrarian::reading_room()`
#> ℹ Or pass `path` to each call, e.g. `webrarian::bind(path =
#>   "/tmp/RtmpQU25pJ/webrarian-clean-demo")`
# Load the engine from the webR CDN, so nothing is downloaded here
settings_set(collection, "build.bundle-engine" = FALSE)
bind(collection)
#> 
#> ── Building webrarian bundle ───────────────────────────────────────────────────
#> Project: "webrarian-clean-demo"
#> webR version: "0.6.0"
#> Output: /tmp/RtmpQU25pJ/webrarian-clean-demo/_site
#> ℹ Using webR CDN engine (v0.6.0)
#> ℹ Emitting viewer + config...
#> ✔ Emitted viewer with inline config
#> ℹ Emitting viewer + config...

#> ✔ Wrote _headers
#> ℹ Emitting viewer + config...

#> ✔ Emitting viewer + config... [36ms]
#> 
#> ✔ Build complete! Output size: 1.49M (engine 0, packages 0, files 0, viewer 1.49M)
#> 
#> Preview: `webrarian::reading_room("/tmp/RtmpQU25pJ/webrarian-clean-demo")`

# Remove the generated `_site/` directory
clean_shelves(collection)
#> ✔ Cleaned /tmp/RtmpQU25pJ/webrarian-clean-demo/_site

unlink(collection, recursive = TRUE)