stubs_publish
Publish Stub Templates for Customization
Copies framework stub templates to your project's `stubs/` directory, allowing you to customize them. Similar to Laravel's `artisan vendor:publish` command.
Usage
stubs_publish(type = "all", overwrite = FALSE, stubs = NULL)
Arguments
| Argument | Description |
|---|---|
type
|
Character vector. Which stub types to publish:
|
overwrite
|
Logical. Whether to overwrite existing stubs. Default FALSE. |
stubs
|
Character vector. Specific stub names to publish (e.g., "default", "minimal"). If NULL (default), publishes all stubs of the specified type. |
Details
Stub Customization Workflow
- Publish stubs to your project:
stubs_publish() - Edit stubs in
stubs/directory to match your preferences - Use
make_notebook()ormake_script()- your custom stubs are used automatically
Stub Naming Convention
Stubs follow this naming pattern:
- Notebooks:
stubs/notebook-{name}.qmdorstubs/notebook-{name}.Rmd - Scripts:
stubs/script-{name}.R
Framework searches user stubs first, then falls back to built-in stubs.
Available Placeholders
Stubs can use these placeholders:
{filename}- File name without extension{date}- Current date (YYYY-MM-DD)
Returns
Invisible list of published file paths
Examples
# Publish all stubs
stubs_publish()
# Publish only notebook stubs
stubs_publish("notebooks")
# Publish specific stub
stubs_publish(stubs = "default")
# Overwrite existing stubs
stubs_publish(overwrite = TRUE)
See Also
Source: R/stubs.R