aboutsummaryrefslogtreecommitdiffstats
path: root/main.go
diff options
context:
space:
mode:
Diffstat (limited to 'main.go')
-rw-r--r--main.go18
1 files changed, 13 insertions, 5 deletions
diff --git a/main.go b/main.go
index 075caa4..870e0f9 100644
--- a/main.go
+++ b/main.go
@@ -2,7 +2,9 @@ package main
import (
"fmt"
+ "github.com/otiai10/copy"
"os"
+ "path/filepath"
)
func main() {
@@ -13,10 +15,10 @@ func main() {
}
// read config file specified in the command line
- cfg, err := readConfig(os.Args[1])
- if err != nil {
- panic(err)
- }
+ cfg := readConfig(os.Args[1])
+
+ // create temporary target directory
+ tmp := createTempDir("godocs")
// gather all sites in docsRoot
sites := getSites(cfg)
@@ -32,6 +34,12 @@ func main() {
createNavSlice(&site, cfg)
// output the site
- generateSite(site, cfg)
+ generateSite(site, cfg, tmp)
+ }
+
+ // copy CSS file to generation directory
+ err := copy.Copy(cfg.CssFile, filepath.Join(tmp, "style.css"))
+ if err != nil {
+ panic(err)
}
}