Skip to contents

Update configuration values in the _webrarian.yml file. The file is rewritten as a whole, so comments in it are not preserved.

Usage

settings_set(path = ".", ...)

Arguments

path

Path to project directory.

...

Named arguments to set. A name is a key whose levels are separated by . or / ("build.output-dir" or "build/output_dir"). Within a level, hyphens and underscores are interchangeable, except below brand. A NULL value writes an explicit null, so the default applies.

Value

Invisibly returns the updated configuration.

Examples

# Work in a throwaway collection under tempdir()
collection <- file.path(tempdir(), "webrarian-settings-demo")
catalog(collection)
#> ✔ Created directory /tmp/RtmpQU25pJ/webrarian-settings-demo
#> ✔ Created _webrarian.yml
#> ✔ Added "_site/" and ".webrarian/" to .gitignore
#> ✔ Cataloged webrarian collection: "webrarian-settings-demo"
#> 
#> Next steps:
#>   Move into the collection: `setwd("/tmp/RtmpQU25pJ/webrarian-settings-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-settings-demo")`

settings_set(collection, "webr.version" = "0.6.0")
settings_set(collection, "project.name" = "my-app", "build.output-dir" = "public")

config <- collection_settings(collection)
settings_get(config, "project.name")
#> [1] "my-app"
settings_get(config, "build.output-dir")
#> [1] "public"

unlink(collection, recursive = TRUE)