templates/templates.go
func New(opts ...Option) (t *Templates, err error) {
	functions := template.FuncMap{}
	for name, fn := range defaultFunctions {
		functions[name] = fn
	}
	o := &Options{
		fileFindFunc: func(f string) string {
			return f
		},
		fileReadFunc: ioutil.ReadFile,
		files:        map[string][]string{},
		functions:    functions,
		delimOpen:    "{{",
		delimClose:   "}}",
		logf:         log.Printf,
	}
	for _, opt := range opts {
		opt(o)
	}

	t = &Templates{
		templates:   map[string]*template.Template{},
		contentType: o.contentType,
		logf:        o.logf,
	}
	for name, strings := range o.strings {
		tpl, err := parseStrings(template.New("").Funcs(o.functions).Delims(o.delimOpen, o.delimClose), strings...)
		if err != nil {
			return nil, err
		}
		t.templates[name] = tpl
	}
	for name, files := range o.files {
		fs := []string{}
		for _, f := range files {
			fs = append(fs, o.fileFindFunc(f))
		}
		tpl, err := parseFiles(o.fileReadFunc, template.New("").Funcs(o.functions).Delims(o.delimOpen, o.delimClose), fs...)
		if err != nil {
			return nil, err
		}
		t.templates[name] = tpl
	}
	return
}
func New(opts ...Option) (t *Templates, err error) {
	functions := template.FuncMap{}
	for name, fn := range defaultFunctions {
		functions[name] = fn
	}
	o := &Options{
		fileFindFunc: func(f string) string {
			return f
		},
		fileReadFunc: ioutil.ReadFile,
		files:        map[string][]string{},
		functions:    functions,
		delimOpen:    "{{",
		delimClose:   "}}",
		logf:         log.Printf,
	}
	for _, opt := range opts {
		opt(o)
	}

	t = &Templates{
		templates:   map[string]*template.Template{},
		contentType: o.contentType,
		logf:        o.logf,
	}
	for name, strings := range o.strings {
		tpl, err := parseStrings(template.New("").Funcs(o.functions).Delims(o.delimOpen, o.delimClose), strings...)
		if err != nil {
			return nil, err
		}
		t.templates[name] = tpl
	}
	for name, files := range o.files {
		fs := []string{}
		for _, f := range files {
			fs = append(fs, o.fileFindFunc(f))
		}
		tpl, err := parseFiles(o.fileReadFunc, template.New("").Funcs(o.functions).Delims(o.delimOpen, o.delimClose), fs...)
		if err != nil {
			return nil, err
		}
		t.templates[name] = tpl
	}
	return
}
// New creates a new instance of Templates and parses
// provided files and strings.