Does typst support conditional compile?

Such as

ENV_VAR=xxx typst compile ...

We can output different content according to the compile environment variables.
Or some other methods to reach it too.

We can use --input

1 Like

Can you please expand on this answer with an example of how to use —input or a link to the documentation?

Using --input you can pass key-value pairs into your document:

typst compile main.typ --input foo=bar

These are accessible via the sys.inputs dictionary.

Example:

The `sys.inputs` dictionary has the following keys: #sys.inputs.keys().
The first value is #sys.inputs.at("foo").
Output

2 Likes