Documentation
¶
Index ¶
- Variables
- func RegisterFunc(name string, fn any)
- func RegisterFuncs(funcs template.FuncMap)
- func RegisterPluginViews(prefix string, filesystem fs.FS)
- func Render(name string, data any) (string, error)
- func SetRoot(root string)
- type Context
- type Engine
- type Props
- func (p *Props) Except(keys []any) *Props
- func (p *Props) Get(key string, fallback ...any) any
- func (p *Props) Has(key string) bool
- func (p *Props) Merge(defaults map[string]any) *Props
- func (p *Props) MergeIf(cond bool, defaults map[string]any) *Props
- func (p *Props) MergeUnless(cond bool, defaults map[string]any) *Props
- func (p *Props) Only(keys []any) *Props
- func (p *Props) ToAttrs() template.HTMLAttr
Constants ¶
This section is empty.
Variables ¶
View Source
var OnRendered func(name string, duration time.Duration, data any)
OnRendered is called after a successful template render.
Functions ¶
func RegisterFunc ¶
RegisterFunc registers a global template function.
func RegisterFuncs ¶
RegisterFuncs registers multiple global template functions.
func RegisterPluginViews ¶
RegisterPluginViews registers an embedded FS for views.
Types ¶
type Context ¶
type Context struct {
// contains filtered or unexported fields
}
Context represents the provide/inject context store.
type Engine ¶
type Engine struct {
// contains filtered or unexported fields
}
Engine renders .nimbus templates (Edge-style: {{ variable }}, {{{ raw }}}, @if, @each, @layout, @component).
var Default *Engine
Default engine.
func New ¶
New creates a view engine with views loaded from root (e.g. "views"). Templates use .nimbus extension.
type Props ¶
type Props struct {
// contains filtered or unexported fields
}
Props represents HTML element attributes and helper APIs.
func (*Props) MergeUnless ¶
MergeUnless merges defaults if condition is false.
Click to show internal directories.
Click to hide internal directories.