goweb/template/html/provider.go

17 lines
480 B
Go
Raw Normal View History

package html
2019-07-28 13:11:23 +02:00
import "gitlab.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...)
2020-01-24 13:09:16 +01:00
err := templateService.LoadTemplatesDir(templateDir)
return func(container *service.Container) (interface{}, error) {
if err != nil {
return nil, err
}
return templateService, nil
}
}