render() — astro Function Reference
Architecture documentation for the render() function in render-template.ts from the astro codebase.
Entity Profile
Dependency Diagram
graph TD 852c9565_5de5_4aa5_caaa_2b9cb89db9e3["render()"] a09367a5_8fe9_7718_47bb_f1d1ba04f076["RenderTemplateResult"] 852c9565_5de5_4aa5_caaa_2b9cb89db9e3 -->|defined in| a09367a5_8fe9_7718_47bb_f1d1ba04f076 style 852c9565_5de5_4aa5_caaa_2b9cb89db9e3 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
packages/astro/src/runtime/server/render/astro/render-template.ts lines 35–74
render(destination: RenderDestination): void | Promise<void> {
// Render all expressions eagerly and in parallel
const flushers = this.expressions.map((exp) => {
return createBufferedRenderer(destination, (bufferDestination) => {
// Skip render if falsy, except the number 0
if (exp || exp === 0) {
return renderChild(bufferDestination, exp);
}
});
});
let i = 0;
const iterate = (): void | Promise<void> => {
while (i < this.htmlParts.length) {
const html = this.htmlParts[i];
const flusher = flushers[i];
// increment here due to potential return in
// Promise scenario
i++;
if (html) {
// only write non-empty strings
destination.write(markHTMLString(html));
}
if (flusher) {
const result = flusher.flush();
if (isPromise(result)) {
return result.then(iterate);
}
}
}
};
return iterate();
}
Domain
Subdomains
Source
Frequently Asked Questions
What does render() do?
render() is a function in the astro codebase, defined in packages/astro/src/runtime/server/render/astro/render-template.ts.
Where is render() defined?
render() is defined in packages/astro/src/runtime/server/render/astro/render-template.ts at line 35.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free