项目选项
定义项目类型、渲染目标和输出的选项。项目选项在 project
键下指定。例如:
_quarto.yml
project:
type: default
output-dir: _output
title |
|
type |
Project type ( |
render |
Files to render (defaults to all files) |
execute-dir |
Control the working directory for computations.
|
output-dir |
Output directory |
lib-dir |
HTML library (JS/CSS/etc.) directory |
resources |
Additional file resources to be copied to output directory |
preview |
Options for |
pre-render |
Scripts to run as a pre-render step |
post-render |
Scripts to run as a post-render step |
预览
在 preview
键下指定控制 quarto preview
行为的选项。例如:
_quarto.yml
project:
type: default
output-dir: _output
preview:
port: 4200
browser: false
可用的 preview
选项包括:
port |
Port to listen on (defaults to random value between 3000 and 8000) |
host |
Hostname to bind to (defaults to 127.0.0.1) |
serve |
Options for external preview server (see Serve) |
browser |
Open a web browser to view the preview (defaults to true) |
watch-inputs |
Re-render input files when they change (defaults to true) |
navigate |
Navigate the browser automatically when outputs are updated (defaults to true) |
timeout |
Time (in seconds) after which to exit if there are no active clients |
服务
如果你正在为包含自己的预览服务器的另一个发布系统创建项目扩展(例如,Hugo 或 Docusaurus),那么使用 preview: serve
选项来自定义预览服务器的行为。
_quarto.yml
project:
type: default
preview:
serve:
cmd: "hugo serve --port {port} --bind {host} --navigateToChanged"
env:
HUGO_RELATIVEURLS: "true"
ready: "Web Server is available at"
cmd |
Serve project preview using the specified command. Interpolate the |
args |
Additional command line arguments for preview command. |
env |
Environment variables to set for preview command. |
ready |
Regular expression for detecting when the server is ready. |
参见 Hugo 和 Docusaurus 扩展源代码,了解 preview: serve
的示例用法。