Every Grafex composition exports aDocumentation 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.
config object typed as CompositionConfig. This object is the single source of truth for how your composition is sized, styled, and rendered. You can define it once and override individual fields from the CLI or the Node.js API without touching the file. All fields are optional — Grafex falls back to sensible defaults when a field is omitted.
CompositionConfig fields
Composition width in pixels. Defaults to
1200 when not set in config, CLI, or API options.Composition height in pixels. Defaults to
630 when not set in config, CLI, or API options.Device pixel ratio for high-DPI output. A
1200×630 composition with scale: 2 produces a 2400×1260 image — same layout, double the pixel density. Defaults to 1.Default output format. Defaults to
'png'. The CLI --format flag and the API format option override this value.JPEG compression quality, from
1 (lowest) to 100 (highest). Only applies when format is 'jpeg'. Defaults to 90 when not specified and the format is JPEG.CSS stylesheet URLs to load as fonts before rendering. Each entry is injected as a See Fonts for full details.
<link rel="stylesheet"> tag in the HTML <head>, so Google Fonts URLs and any other CSS-serving endpoint work directly. Local file paths are not supported in this field — use config.css with @font-face rules for self-hosted fonts instead.Paths to CSS files to inject into the page before rendering. Paths are resolved relative to the composition file. Each file’s contents are injected as a See CSS Files for full details.
<style> tag in the HTML <head>.Named output variants. Each key becomes a variant name, and each value is a See Variants for full details including merge rules.
VariantConfig that can override any base config field. When variants are defined, grafex export renders all of them by default, naming each output file after its variant key.Attributes to set on the root This renders as
<html> element. Values are HTML-escaped automatically. This is useful for CSS selectors that target the <html> element, such as :root[data-theme="dark"] used by Tailwind v4 and other theming systems.<html data-theme="dark" lang="en">. When a variant also defines htmlAttributes, the variant’s attributes are spread over the base config’s attributes — see Variants for the full merge rules.Complete example
The composition below combines every config field into a single file. It sets base dimensions and format, loads a custom font and a Tailwind CSS stylesheet, setsdata-theme on the HTML element for dark-mode theming, and defines three output variants.
Overriding config at export time
Any field set inconfig can be overridden from the CLI without editing the file:
CLI and API options sit at the top of the override chain: they beat variant config, which beats base config. The priority order is always CLI/API → variant → base config → defaults.