gernest / utron

A lightweight MVC framework for Go(Golang)
MIT License
2.22k stars 149 forks source link

Feature/view factory #94

Open joesteel2010 opened 6 years ago

joesteel2010 commented 6 years ago

I've added in a change to allow the default SimpleView implementation to be replaced by a custom View implementation. Because all templates are parsed when NewMVC is called, there is no way to have templates that rely on other templates in the views directory. This change allows us to define supporting templates and add functions also.

Example usage:

utronView.SetViewFactory(func(viewDir string)(utronView.View, error){ return view.NewComplexView("fragments", viewDir, views.FuncMap) })

app, err := utron.NewMVC("config")

`