Documentation
¶
Index ¶
- func DispatchHotReloadHooks(path string)
- func RegisterHotReloadHook(hook func(path string))
- func RegisterTemplateRuntimeFactory(factory func(baseDir string) TemplateRuntime)
- type SimpleTemplateRuntime
- func (r *SimpleTemplateRuntime) InvalidateCaches()
- func (r *SimpleTemplateRuntime) Render(tmpl string, data map[string]any) (string, error)
- func (r *SimpleTemplateRuntime) RenderFile(path string, data map[string]any) (string, error)
- func (r *SimpleTemplateRuntime) RenderSSR(tmpl string, data map[string]any) (string, error)
- func (r *SimpleTemplateRuntime) RenderSSRFile(path string, data map[string]any) (string, error)
- func (r *SimpleTemplateRuntime) RenderStream(w io.Writer, tmpl string, data map[string]any) error
- func (r *SimpleTemplateRuntime) RenderStreamFile(w io.Writer, path string, data map[string]any) error
- type TemplateRuntime
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DispatchHotReloadHooks ¶
func DispatchHotReloadHooks(path string)
DispatchHotReloadHooks calls all registered hot-reload hooks for the given path.
func RegisterHotReloadHook ¶
func RegisterHotReloadHook(hook func(path string))
RegisterHotReloadHook registers a callback that is invoked when a file is reloaded (e.g. via the REPL :reload command).
func RegisterTemplateRuntimeFactory ¶
func RegisterTemplateRuntimeFactory(factory func(baseDir string) TemplateRuntime)
RegisterTemplateRuntimeFactory sets the factory function used to create TemplateRuntime instances.
Types ¶
type SimpleTemplateRuntime ¶
type SimpleTemplateRuntime struct {
// contains filtered or unexported fields
}
SimpleTemplateRuntime implements a basic template engine for SPL
func (*SimpleTemplateRuntime) InvalidateCaches ¶
func (r *SimpleTemplateRuntime) InvalidateCaches()
func (*SimpleTemplateRuntime) RenderFile ¶
func (*SimpleTemplateRuntime) RenderSSRFile ¶
func (*SimpleTemplateRuntime) RenderStream ¶
func (*SimpleTemplateRuntime) RenderStreamFile ¶
type TemplateRuntime ¶
type TemplateRuntime interface {
Render(tmpl string, data map[string]any) (string, error)
RenderFile(path string, data map[string]any) (string, error)
RenderSSR(tmpl string, data map[string]any) (string, error)
RenderSSRFile(path string, data map[string]any) (string, error)
RenderStream(w io.Writer, tmpl string, data map[string]any) error
RenderStreamFile(w io.Writer, path string, data map[string]any) error
InvalidateCaches()
}
TemplateRuntime defines the interface for template rendering engines.
func NewSimpleTemplateRuntime ¶
func NewSimpleTemplateRuntime(baseDir string) TemplateRuntime
NewSimpleTemplateRuntime creates a new simple template runtime
func NewTemplateRuntime ¶
func NewTemplateRuntime(baseDir string) TemplateRuntime
NewTemplateRuntime creates a TemplateRuntime for the given base directory using the registered factory. Returns nil if no factory has been registered.
Click to show internal directories.
Click to hide internal directories.