Small fix

This commit is contained in:
spsobole 2021-01-30 17:34:04 -07:00
parent 6f29b1e86d
commit 46eb9862e6
1 changed files with 6 additions and 2 deletions

View File

@ -105,7 +105,6 @@ func (s *Server) parseTemplates(t *template.Template, filenames ...string) (*tem
} }
data := string(b) data := string(b)
name := strings.TrimPrefix(filename, s.templates+"/") name := strings.TrimPrefix(filename, s.templates+"/")
log.Println("Template:", name)
// First template becomes return value if not already defined, // First template becomes return value if not already defined,
// and we use that one for subsequent New calls to associate // and we use that one for subsequent New calls to associate
@ -183,7 +182,7 @@ func (s *Server) LoadTemplatesFS(fs http.FileSystem, base string) (*template.Tem
func (s *Server) loadTemplates() *template.Template { func (s *Server) loadTemplates() *template.Template {
tmpl, err := s.LoadTemplatesFS(s.fs, s.templates) tmpl, err := s.LoadTemplatesFS(s.fs, s.templates)
if err != nil { if err != nil {
log.Fatal(err) log.Fatal("loadTemplates", err, s.templates)
} }
return tmpl return tmpl
@ -290,6 +289,11 @@ func (s *Server) WithTheme(themeURL string) *Server {
return s return s
} }
func (s *Server) WithRootFileSystem(fs http.FileSystem) *Server {
s.fs = fs
return s
}
func (s *Server) WithDebug(debugURL string) *Server { func (s *Server) WithDebug(debugURL string) *Server {
sub := s.router.PathPrefix(debugURL).Subrouter() sub := s.router.PathPrefix(debugURL).Subrouter()
setupDebugHandler(sub) setupDebugHandler(sub)