aymerick / raymond

Handlebars for golang
MIT License
610 stars 101 forks source link

ReplacePartial #45

Open dav-m85 opened 3 years ago

dav-m85 commented 3 years ago

I need to replace a partial before Exec (usecase: in dev, want to reload a partial when I edit it)

raw := `{{>partial}}`
tpl, _ := raymond.Parse(raw)

tpl.RegisterPartial("partial", "Bloubi")
tpl.MustExec(tpl) // "Bloubi"

tpl.ReplacePartial("partial", "Boulga")
tpl.MustExec(tpl) // "Boulga"

This is the code for this :)