Documentation Index
Fetch the complete documentation index at: https://mintlify.com/andresilva-cc/grafex/llms.txt
Use this file to discover all available pages before exploring further.
renderAll() is a convenience function for compositions that define multiple variants — for example, an OG image, a Twitter card, and a square thumbnail all produced from the same .tsx file. Instead of calling render() once per variant and managing the loop yourself, renderAll() iterates every entry in config.variants, renders each one with the shared browser instance, and returns a Map keyed by variant name. The composition module is loaded only once regardless of how many variants are defined, so the function is efficient even for large variant sets.
Signature
Parameters
Path to the
.tsx composition file. Resolved relative to the current working directory of the Node.js process.Optional configuration object. Accepts all fields from
RenderOptions except variant — renderAll always renders every variant, so specifying one by name is not applicable here. Any option you provide is applied uniformly across every variant render, acting as a final override on top of each variant’s own config values.Return value
Returns aPromise that resolves to a Map<string, RenderResult>. Each key is the variant name exactly as it appears in config.variants. Each value is a full RenderResult for that variant.
The variant name string from
config.variants — for example 'og', 'twitter', or 'square'.Raw image data for this variant. Write directly to a file with
fs.writeFile.Effective render width in pixels for this variant, after applying
scale.Effective render height in pixels for this variant, after applying
scale.The device pixel ratio used for this variant’s render.
The output format used for this variant.
Behavior when no variants are defined
If the composition file does not export aconfig with a non-empty variants record, renderAll() throws an error:
render() instead for compositions without variants, or use getCompositionConfig() and hasVariants() to check before calling renderAll().
Examples
Variants are rendered sequentially in the order they appear in
config.variants. The map iteration order matches the definition order, so for...of over the result map gives you results in the same sequence.