View source: R/with_brand_yml.R
| with_brand_yml_path | R Documentation |
BRAND_YML_PATH environment variableThis function sets the BRAND_YML_PATH environment variable to the specified
path for the duration of the local environment. This ensures that, for the
scope of the local environment, any calls to functions that automatically
discover a _brand.yml file will use the path specified.
with_brand_yml_path(path, code)
local_brand_yml_path(path, .local_envir = parent.frame())
path |
The path to a brand.yml file. |
code |
|
.local_envir |
|
[any]
The results of the evaluation of the code
argument.
with_brand_yml_path(): Run code in a temporary environment with the
BRAND_YML_PATH environment variable set to path.
local_brand_yml_path(): Set the BRAND_YML_PATH environment variable
for the scope of the local environment (e.g. within the current function).
Other brand.yml helpers:
brand_color_pluck(),
brand_has(),
brand_pluck()
# Create a temporary brand.yml file in a tempdir for this example
tmpdir <- withr::local_tempdir("brand")
path_brand <- file.path(tmpdir, "my-brand.yml")
yaml::write_yaml(
list(color = list(primary = "#abc123")),
path_brand
)
with_brand_yml_path(path_brand, {
brand <- read_brand_yml()
brand$color$primary
})
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.