copy static files directly in go
1 file changed, 10 insertions(+), 0 deletions(-)
changed files
M cmd/build/build.go → cmd/build/build.go
@@ -26,6 +26,7 @@ "github.com/adrg/frontmatter" "github.com/antchfx/xmlquery" "github.com/antchfx/xpath" mapset "github.com/deckarep/golang-set/v2" + cp "github.com/otiai10/copy" "github.com/pkg/errors" "github.com/yuin/goldmark" "github.com/yuin/goldmark/extension"@@ -527,6 +528,15 @@ slog.Debug("starting build process") _, err := os.Getwd() if err != nil { log.Panic(errors.Errorf("working directory does not exist: %v", err)) + } + + err = os.RemoveAll("public") + if err != nil { + log.Panic(errors.Errorf("could not remove public directory: %v", err)) + } + err = cp.Copy("static", "public", cp.Options{}) + if err != nil { + log.Panic(errors.Errorf("could not copy static files: %v", err)) } if err := build(); err != nil {