Documentation
¶
Overview ¶
templui util templui.go - version: v1.3.0 installed by templui v1.3.0
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ScriptURL = func(path string) string { return path + "?v=" + ScriptVersion }
ScriptURL generates cache-busted script URLs. Override this to use custom cache busting (CDN, content hashing, etc.)
Example override in your app:
func init() {
utils.ScriptURL = func(path string) string {
return myAssetManifest.GetURL(path)
}
}
var ScriptVersion = fmt.Sprintf("%d", time.Now().Unix())
ScriptVersion is a timestamp generated at app start for cache busting. Used in Script() templates to append ?v=<timestamp> to script URLs.
Functions ¶
func If ¶
func If[T comparable](condition bool, value T) T
TwIf returns value if condition is true, otherwise an empty value of type T. Example: true, "bg-red-500" → "bg-red-500"
func IfElse ¶
TwIfElse returns trueValue if condition is true, otherwise falseValue. Example: true, "bg-red-500", "bg-gray-300" → "bg-red-500"
func MergeAttributes ¶
func MergeAttributes(attrs ...templ.Attributes) templ.Attributes
MergeAttributes combines multiple Attributes into one. Example: MergeAttributes(attr1, attr2) → combined attributes
Types ¶
This section is empty.