mirror of
https://github.com/gohugoio/hugo.git
synced 2024-11-07 20:30:36 -05:00
The missing static directory shouldn't fail the build
The lack of the directory would be worth to warn, since the directory is created by "huge new site". But it doesn't have to fail the build. This change fixes #759.
This commit is contained in:
parent
4e9a5d8bd1
commit
3a412543f6
1 changed files with 10 additions and 10 deletions
|
@ -328,12 +328,6 @@ func build(watches ...bool) {
|
|||
}
|
||||
|
||||
func copyStatic() error {
|
||||
staticDir := helpers.AbsPathify(viper.GetString("StaticDir")) + "/"
|
||||
if _, err := os.Stat(staticDir); os.IsNotExist(err) {
|
||||
jww.ERROR.Println("Unable to find Static Directory:", staticDir)
|
||||
return nil
|
||||
}
|
||||
|
||||
publishDir := helpers.AbsPathify(viper.GetString("PublishDir")) + "/"
|
||||
|
||||
syncer := fsync.NewSyncer()
|
||||
|
@ -347,15 +341,21 @@ func copyStatic() error {
|
|||
return nil
|
||||
}
|
||||
|
||||
// Copy the theme's static directory
|
||||
if themeDir != "" {
|
||||
// Copy Static to Destination
|
||||
jww.INFO.Println("syncing from", themeDir, "to", publishDir)
|
||||
utils.CheckErr(syncer.Sync(publishDir, themeDir), fmt.Sprintf("Error copying static files of theme to %s", publishDir))
|
||||
}
|
||||
|
||||
// Copy Static to Destination
|
||||
jww.INFO.Println("syncing from", staticDir, "to", publishDir)
|
||||
return syncer.Sync(publishDir, staticDir)
|
||||
// Copy the site's own static directory
|
||||
staticDir := helpers.AbsPathify(viper.GetString("StaticDir")) + "/"
|
||||
if _, err := os.Stat(staticDir); err == nil {
|
||||
jww.INFO.Println("syncing from", staticDir, "to", publishDir)
|
||||
return syncer.Sync(publishDir, staticDir)
|
||||
} else if os.IsNotExist(err) {
|
||||
jww.WARN.Println("Unable to find Static Directory:", staticDir)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// getDirList provides NewWatcher() with a list of directories to watch for changes.
|
||||
|
|
Loading…
Reference in a new issue