aboutsummaryrefslogtreecommitdiffstats
path: root/main.go
diff options
context:
space:
mode:
authorEddy Pedroni <eddy@0xf7.com>2020-02-01 18:30:23 +0100
committerEddy Pedroni <eddy@0xf7.com>2020-02-01 18:30:34 +0100
commit633a882544d3b54cc7b7cfc96359a2ca1497d766 (patch)
treee0d677381b1647104a231103f12776d61c2a871e /main.go
parentace49dc8ef6eb5236eed364f885ff6ed76554188 (diff)
Added CSS copy, img symlink generation
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)
}
}