This commit is contained in:
Henrique Dias 2016-02-11 20:52:56 +00:00
parent b266262c7a
commit c8c2d4e9b5
2 changed files with 2 additions and 6 deletions

View File

@ -143,9 +143,7 @@ func parseCompleteFile(r *http.Request, c *config.Config, rawFile map[string]int
file := f.Bytes() file := f.Bytes()
// Write the file // Write the file
err = ioutil.WriteFile(filename, file, 0666) if err = ioutil.WriteFile(filename, file, 0666); err != nil {
if err != nil {
return return
} }

View File

@ -14,7 +14,6 @@ import (
"github.com/hacdias/caddy-hugo/assets" "github.com/hacdias/caddy-hugo/assets"
"github.com/hacdias/caddy-hugo/config" "github.com/hacdias/caddy-hugo/config"
"github.com/spf13/hugo/commands" "github.com/spf13/hugo/commands"
"github.com/spf13/viper"
) )
// CanBeEdited checks if the extension of a file is supported by the editor // CanBeEdited checks if the extension of a file is supported by the editor
@ -166,8 +165,7 @@ func ParseComponents(r *http.Request) []string {
// Run is used to run the static website generator // Run is used to run the static website generator
func Run(c *config.Config) { func Run(c *config.Config) {
viper.Reset() c.Args = append([]string{"--source", c.Path}, c.Args...)
c.Args = append([]string{"--source", c.Path, "--destination", "public"}, c.Args...)
commands.HugoCmd.ParseFlags(c.Args) commands.HugoCmd.ParseFlags(c.Args)
if err := commands.HugoCmd.RunE(nil, nil); err != nil { if err := commands.HugoCmd.RunE(nil, nil); err != nil {
log.Print(err) log.Print(err)