MCPcopy Create free account
hub / github.com/CloudyKit/jet / loadFromFile

Method loadFromFile

set.go:186–197  ·  view source on GitHub ↗
(templatePath string, cacheAfterParsing bool)

Source from the content-addressed store, hash-verified

184}
185
186func (s *Set) loadFromFile(templatePath string, cacheAfterParsing bool) (template *Template, err error) {
187 f, err := s.loader.Open(templatePath)
188 if err != nil {
189 return nil, err
190 }
191 defer f.Close()
192 content, err := ioutil.ReadAll(f)
193 if err != nil {
194 return nil, err
195 }
196 return s.parse(templatePath, string(content), cacheAfterParsing)
197}
198
199// Parse parses `contents` as if it were located at `templatePath`, but won't put the result into the cache.
200// Any referenced template (e.g. via `extends` or `import` statements) will be tried to be loaded from the cache.

Callers 1

getTemplateFromLoaderMethod · 0.95

Calls 2

parseMethod · 0.95
OpenMethod · 0.65

Tested by

no test coverage detected