William Petit
985ce3eba3
Allow customization of the template loading process by providing a Loader implementation. Allow auto-reloading of templates in development mode.
17 lines
460 B
Go
17 lines
460 B
Go
package html
|
|
|
|
import "gitlab.com/wpetit/goweb/service"
|
|
|
|
// ServiceProvider returns a service.Provider for the
|
|
// the HTML template service implementation
|
|
func ServiceProvider(loader Loader, funcs ...OptionFunc) service.Provider {
|
|
templateService := NewTemplateService(loader, funcs...)
|
|
err := templateService.Load()
|
|
return func(container *service.Container) (interface{}, error) {
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return templateService, nil
|
|
}
|
|
}
|