Add html template service provider factory
This commit is contained in:
parent
bd676c234f
commit
9b13461e93
|
@ -0,0 +1,16 @@
|
|||
package html
|
||||
|
||||
import "forge.cadoles.com/wpetit/goweb/service"
|
||||
|
||||
// ServiceProvider returns a service.Provider for the
|
||||
// the HTML template service implementation
|
||||
func ServiceProvider(templateDir string, funcs ...OptionFunc) service.Provider {
|
||||
templateService := NewTemplateService(funcs...)
|
||||
err := templateService.LoadTemplates(templateDir)
|
||||
return func(container *service.Container) (interface{}, error) {
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return templateService, nil
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue