summaryrefslogtreecommitdiffstats
path: root/main.go
diff options
context:
space:
mode:
authorspf13 <steve.francia@gmail.com>2013-07-30 01:26:02 -0400
committerspf13 <steve.francia@gmail.com>2013-07-30 01:26:02 -0400
commit61258858af90fc43bea406af5f065d0b2e6c94dc (patch)
tree973034bfd11e2c682648657df44826a0245ecfed /main.go
parent736677a21d8b10c3a34c5f383849ba186ff296b1 (diff)
copying static content to destination
Diffstat (limited to 'main.go')
-rw-r--r--main.go16
1 files changed, 12 insertions, 4 deletions
diff --git a/main.go b/main.go
index f99357c1f..2a7585242 100644
--- a/main.go
+++ b/main.go
@@ -16,8 +16,10 @@ package main
import (
"fmt"
"github.com/howeyc/fsnotify"
+ "github.com/mostafah/fsync"
flag "github.com/ogier/pflag"
"github.com/spf13/hugo/hugolib"
+ "log"
"net/http"
"os"
"path/filepath"
@@ -63,16 +65,16 @@ func main() {
config.UglyUrls = *uglyUrls
config.Verbose = *verbose
- if *destination != "" {
- config.PublishDir = *destination
- }
-
if *baseUrl != "" {
config.BaseUrl = *baseUrl
} else if *server {
config.BaseUrl = "http://localhost:" + *port
}
+ if *destination != "" {
+ config.PublishDir = *destination
+ }
+
if *version {
fmt.Println("Hugo Static Site Generator v0.8")
}
@@ -92,6 +94,12 @@ func main() {
}
}
+ // Copy Static to Destination first
+ err := fsync.SyncDel(config.GetAbsPath(config.PublishDir+"/"), config.GetAbsPath(config.StaticDir+"/"))
+ if err != nil {
+ log.Fatalf("Error copying static files to %s: %v", config.GetAbsPath(config.PublishDir), err)
+ }
+
if *checkMode {
site := hugolib.NewSite(config)
site.Analyze()