Build a single binary with templates
You can build a server into a single binary containing templates by using [go-bindata][https://github.com/go-bindata/go-bindata]'s AssetFile
generated function.
$ go get -u github.com/go-bindata/go-bindata/...
$ go-bindata -fs -prefix "templates" ./templates/...
$ go run .
Example Code:
func main() {
app := iris.New()
tmpl := iris.HTML(AssetFile(), ".html")
tmpl.Layout("layouts/layout.html")
tmpl.AddFunc("greet", func(s string) string {
return "Greetings " + s + "!"
})
app.RegisterView(tmpl)
// [...]
}
See complete examples at the _examples/view.