Documentation
¶
Index ¶
- Constants
- Variables
- func CopyAndRenderFile(tmplCtx *templating.TemplateContext, src, target string) error
- func GetFileCandidates(baseName string, extensions ...string) []string
- func ReadAndRenderFile(tmplCtx *templating.TemplateContext, src string) ([]byte, error)
- func RemoveTemplateExt(filename string) string
- func ResolveFirstExistingFile(root string, candidates ...string) (string, error)
Constants ¶
const TemplateExtensionGoTemplate = "gotpl"
TemplateExtensionGoTemplate is the file extension used for Go template files.
Variables ¶
var NoFileCandidatesErr = errors.New("no file candidates found")
NoFileCandidatesErr is returned when no matching file candidates exist on disk.
Functions ¶
func CopyAndRenderFile ¶
func CopyAndRenderFile(tmplCtx *templating.TemplateContext, src, target string) error
CopyAndRenderFile copies src to target, rendering it through a template processor if the file extension matches a supported templating engine.
func GetFileCandidates ¶
GetFileCandidates returns all possible file names for a base name, including templated variants for each supported template extension.
func ReadAndRenderFile ¶ added in v0.12.2
func ReadAndRenderFile(tmplCtx *templating.TemplateContext, src string) ([]byte, error)
ReadAndRenderFile reads src and renders it through a template processor if the file extension matches a supported templating engine. Returns raw content otherwise.
func RemoveTemplateExt ¶
RemoveTemplateExt strips a recognized template extension (e.g. ".gotpl") from the filename if present.
Types ¶
This section is empty.