Documentation
¶
Overview ¶
Package facet renders React/TSX templates to HTML, PDF or PNG through facet.
facet is a TSX/React to Chromium print pipeline with no Go SDK, so a caller either POSTs to a `facet serve` instance (RenderHTTP) or execs the CLI (RenderCLI). Prefer the HTTP API whenever a server is configured: it keeps a warm Chromium worker pool, which is the difference between a ~1.4s render and a ~11s one, and keeps ~1GB of Chromium out of this process.
Index ¶
Constants ¶
This section is empty.
Variables ¶
ErrRendererUnavailable is returned when the facet binary is not installed. It is a distinct error so a deployment missing its renderer fails with an install hint rather than opaquely on every run.
Functions ¶
Types ¶
type Request ¶
type Request struct {
// SrcDir is the template directory; Entry is the entry file relative to it.
SrcDir, Entry string
Data any
// Format is html, pdf or png.
Format string
// Runtime names a prebuilt facet runtime (name, name@version or folder).
// Only the CLI can select one.
Runtime string
// Options are extra render options: `--<kebab-key>` flags for the CLI,
// merged into the options JSON for the server.
Options map[string]any
Timeout time.Duration
}
Request is one render.