Home / Function/ render() — vue Function Reference

render() — vue Function Reference

Architecture documentation for the render() function in index.ts from the vue codebase.

Entity Profile

Dependency Diagram

graph TD
  31737441_3215_1599_6096_babd073ce4a3["render()"]
  6267c156_f90f_17b7_4f37_300535e21f45["TemplateRenderer"]
  31737441_3215_1599_6096_babd073ce4a3 -->|defined in| 6267c156_f90f_17b7_4f37_300535e21f45
  de548355_dee5_dd21_62f9_410697a83cc6["createRenderer()"]
  de548355_dee5_dd21_62f9_410697a83cc6 -->|calls| 31737441_3215_1599_6096_babd073ce4a3
  7c7d334f_3782_7894_ca93_084f14d54628["renderResourceHints()"]
  31737441_3215_1599_6096_babd073ce4a3 -->|calls| 7c7d334f_3782_7894_ca93_084f14d54628
  5894a37d_9192_b727_818d_1e75532b2f51["renderStyles()"]
  31737441_3215_1599_6096_babd073ce4a3 -->|calls| 5894a37d_9192_b727_818d_1e75532b2f51
  a7382fc7_2a1c_21c4_593d_a281d216bdcd["renderState()"]
  31737441_3215_1599_6096_babd073ce4a3 -->|calls| a7382fc7_2a1c_21c4_593d_a281d216bdcd
  774bdfd4_b797_21a8_42aa_0b7360c53c24["renderScripts()"]
  31737441_3215_1599_6096_babd073ce4a3 -->|calls| 774bdfd4_b797_21a8_42aa_0b7360c53c24
  style 31737441_3215_1599_6096_babd073ce4a3 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/server-renderer/src/template-renderer/index.ts lines 107–141

  render(
    content: string,
    context: Record<string, any> | null
  ): string | Promise<string> {
    const template = this.parsedTemplate
    if (!template) {
      throw new Error('render cannot be called without a template.')
    }
    context = context || {}

    if (typeof template === 'function') {
      return template(content, context)
    }

    if (this.inject) {
      return (
        template.head(context) +
        (context.head || '') +
        this.renderResourceHints(context) +
        this.renderStyles(context) +
        template.neck(context) +
        content +
        this.renderState(context) +
        this.renderScripts(context) +
        template.tail(context)
      )
    } else {
      return (
        template.head(context) +
        template.neck(context) +
        content +
        template.tail(context)
      )
    }
  }

Subdomains

Called By

Frequently Asked Questions

What does render() do?
render() is a function in the vue codebase, defined in packages/server-renderer/src/template-renderer/index.ts.
Where is render() defined?
render() is defined in packages/server-renderer/src/template-renderer/index.ts at line 107.
What does render() call?
render() calls 4 function(s): renderResourceHints, renderScripts, renderState, renderStyles.
What calls render()?
render() is called by 1 function(s): createRenderer.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free