Support PostProcess for all file types

Not just HTML.

Fixes #10269
This commit is contained in:
Bjørn Erik Pedersen
2022-09-14 11:58:45 +02:00
parent 1fd4c562af
commit 74daca6b30
9 changed files with 265 additions and 24 deletions

View File

@@ -18,7 +18,6 @@ import (
"context"
"encoding/json"
"fmt"
"os"
"path/filepath"
"runtime/trace"
"strings"
@@ -439,23 +438,15 @@ func (h *HugoSites) postProcess() error {
return nil
}
_ = afero.Walk(h.BaseFs.PublishFs, "", func(path string, info os.FileInfo, err error) error {
if info == nil || info.IsDir() {
return nil
}
if !strings.HasSuffix(path, "html") {
return nil
}
for _, filename := range h.Deps.FilenameHasPostProcessPrefix {
filename := filename
g.Run(func() error {
return handleFile(path)
return handleFile(filename)
})
return nil
})
}
// Prepare for a new build.
h.Deps.FilenameHasPostProcessPrefix = nil
for _, s := range h.Sites {
s.ResourceSpec.PostProcessResources = make(map[string]postpub.PostPublishedResource)
}