~evanj/evanjon.es

4d7237dc8978d58b315b28f3e5b3cf5d9df121c3 — Evan M Jones a month ago df42954 master
Feat(tmpls): Slight change to template parsing/minifying.
1 files changed, 3 insertions(+), 6 deletions(-)

M internal/s/tmpl/tmpl.go
M internal/s/tmpl/tmpl.go => internal/s/tmpl/tmpl.go +3 -6
@@ 14,7 14,7 @@ import (
//go:generate embed -pattern */* -id tmpls

var (
	all      *template.Template
	all      = template.New("cms")
	minifier = minify.New()
	once     sync.Once
)


@@ 24,12 24,8 @@ func MustParse(name string) *template.Template {
		minifier.AddFunc("text/css", css.Minify)
		minifier.AddFunc("text/html", html.Minify)
		minifier.AddFunc("application/javascript", js.Minify)
	})

	if all == nil {
		all = template.New("cms")
		for key, val := range tmpls {

			var err error
			ext := filepath.Ext(key)



@@ 51,6 47,7 @@ func MustParse(name string) *template.Template {

			all = template.Must(all.New(key).Parse(val))
		}
	}
	})

	return all.Lookup(name)
}