about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorAlan Pearce2024-04-19 14:47:47 +0200
committerAlan Pearce2024-04-19 14:47:47 +0200
commita4e0ebceb8e664bf3f6e3dc36df0120a9ea9803e (patch)
treebeb8588c92b3ea0d45b9216329fcd80a59f43a0f
parent731d1c63dca1c8bf6d99e9c0f316f59595861ac8 (diff)
downloadwebsite-a4e0ebceb8e664bf3f6e3dc36df0120a9ea9803e.tar.lz
website-a4e0ebceb8e664bf3f6e3dc36df0120a9ea9803e.tar.zst
website-a4e0ebceb8e664bf3f6e3dc36df0120a9ea9803e.zip
build: use same dir for static/rendered output
-rw-r--r--cmd/build/build.go10
1 files changed, 5 insertions, 5 deletions
diff --git a/cmd/build/build.go b/cmd/build/build.go
index 8a8cd68..058b82f 100644
--- a/cmd/build/build.go
+++ b/cmd/build/build.go
@@ -402,12 +402,11 @@ func outputToFile(output io.Reader, filename ...string) error {
 	return nil
 }
 
-func build() error {
+func build(outDir string) error {
 	config, err := config.GetConfig()
 	if err != nil {
 		return err
 	}
-	outDir := "public"
 	if err := mkdirp(outDir, "post"); err != nil {
 		return errors.WithMessage(err, "could not create post output directory")
 	}
@@ -530,18 +529,19 @@ func main() {
 		log.Panic(errors.Errorf("working directory does not exist: %v", err))
 	}
 
+	outDir := "public"
 	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{
-		PreserveTimes:     true,
+	err = cp.Copy("static", outDir, cp.Options{
+		PreserveTimes: true,
 	})
 	if err != nil {
 		log.Panic(errors.Errorf("could not copy static files: %v", err))
 	}
 
-	if err := build(); err != nil {
+	if err := build(outDir); err != nil {
 		switch cause := errors.Cause(err).(type) {
 		case *fs.PathError:
 			slog.Info("pathError")