Skip to content

Define profiles with an argument? #95

@andrewheiss

Description

@andrewheiss

Starting with v1.2, Quarto supports project profiles that let you customize overall project _quarto.yml files for specific situations, like production vs. development, or basic book vs. advanced book. For instance, these three YAML files define two different versions of a document (here with different authors):

_quarto.yml

project:
  output-dir: _output

profile:
  default: basic

_quarto-basic.yml

author: Basic author

format:
  html:
    output-file: "basic.html"

_quarto-advanced.yml

author: Advanced author

format:
  html:
    output-file: "advanced.html"

testing.qmd

---
title: "Testing"
---

Test.

It's possible to switch profiles either with environment variables…

export QUARTO_PROFILE=advanced
quarto render .

…or a command line switch:

quarto render . --profile advanced

It would be helpful to be able to specify the desired profile(s) in quarto_render() and quarto_preview(). Right now it just uses whatever is set to the default (basic in this example). It could be helpful to control environments in order to create different outputs for multiple profiles. For instance, something like this could be added to a sort of rendering script and generate basic and advanced versions of the document simultaneously:

quarto::quarto_render(".", profile = "basic")  # Create basic.html
quarto::quarto_render(".", profile = "advanced")  # Create advanced.html

An argument like this would also allow wrapper packages like tarchetypes::tar_quarto() to use specific profiles (see ropensci/tarchetypes#139 for a similar issue for adding profile support for {targets})

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

Status

Done

Relationships

None yet

Development

No branches or pull requests

Issue actions