Skip to content

Commit

Permalink
chore: cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
lukasjarosch committed Feb 8, 2024
1 parent 450b6de commit e2fadf1
Showing 1 changed file with 1 addition and 15 deletions.
16 changes: 1 addition & 15 deletions template.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,6 @@ func NewTemplater(fileSystem afero.Fs, templateRootPath, outputRootPath string,

t.DiscoverPartials()

fmt.Println(len(t.partialTemplates))

return t, nil
}

Expand Down Expand Up @@ -199,20 +197,9 @@ func (t *Templater) execute(tplFile *File, data any, targetPath string, allowNoV
// create new target template with the attached functions
tpl := template.New(tplFile.Path).Funcs(t.templateFuncs)

// before parsing every template, we need to ignore those which should be ignored via the IgnoreRegex
// this function just returns true if a file must not be parsed.
ignoreFile := func(filePath string) bool {
for _, v := range t.IgnoreRegex {
if v.MatchString(filePath) {
return true
}
}
return false
}

// Add every discovered partial template in case its needed.
for _, partialTemplate := range t.partialTemplates {
if ignoreFile(partialTemplate.Path) {
if t.pathIsIgnored(partialTemplate.Path) {
continue
}

Expand Down Expand Up @@ -265,7 +252,6 @@ func (t *Templater) ExecuteComponents(data any, components []ComponentConfig, al

for _, component := range components {
for _, input := range component.InputPaths {

file := t.getTemplateByPath(input)

if file == nil {
Expand Down

0 comments on commit e2fadf1

Please sign in to comment.