render

package
v0.0.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 5, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Entry

type Entry struct {
	Comp  string
	Props map[string]any
}

Entry represents a component to be rendered, along with its props.

type RenderData

type RenderData struct {
	Entries []Entry
	ErrPage string
	SCData  SvelteContextData
}

type Renderer

type Renderer struct {
	// contains filtered or unexported fields
}

Renderer is a renderer for svelte components. It is safe to use concurrently across threads.

func New

func New(fsys fs.FS) *Renderer

New constructs a renderer from the given FS. The FS should be the "server" subdirectory of the build output from "npx golte". The second argument is the path where the JS, CSS, and other assets are expected to be served.

func (*Renderer) Assets

func (r *Renderer) Assets() string

Assets returns the "assets" field that was used in the golte configuration file.

func (*Renderer) Render

func (r *Renderer) Render(w http.ResponseWriter, data RenderData, csr bool) error

Render renders a slice of entries into the writer.

type SvelteContextData

type SvelteContextData struct {
	URL string
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL