mirror of
https://github.com/gohugoio/hugo.git
synced 2024-11-21 20:46:30 -05:00
parent
1921a70ab1
commit
5235a5bf5e
1 changed files with 20 additions and 9 deletions
|
@ -561,25 +561,36 @@ func (c *commandeer) fullBuild(watches ...bool) error {
|
||||||
}()
|
}()
|
||||||
}
|
}
|
||||||
|
|
||||||
g.Go(func() error {
|
copyStaticFunc := func() error {
|
||||||
cnt, err := c.copyStatic()
|
cnt, err := c.copyStatic()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("Error copying static files: %s", err)
|
return fmt.Errorf("Error copying static files: %s", err)
|
||||||
}
|
}
|
||||||
langCount = cnt
|
langCount = cnt
|
||||||
return nil
|
return nil
|
||||||
})
|
}
|
||||||
|
buildSitesFunc := func() error {
|
||||||
g.Go(func() error {
|
|
||||||
if err := c.buildSites(); err != nil {
|
if err := c.buildSites(); err != nil {
|
||||||
return fmt.Errorf("Error building site: %s", err)
|
return fmt.Errorf("Error building site: %s", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
})
|
}
|
||||||
|
// Do not copy static files and build sites in parallel if cleanDestinationDir is enabled.
|
||||||
if err := g.Wait(); err != nil {
|
// This flag deletes all static resources in /public folder that are missing in /static,
|
||||||
return err
|
// and it does so at the end of copyStatic() call.
|
||||||
|
if c.Cfg.GetBool("cleanDestinationDir") {
|
||||||
|
if err := copyStaticFunc(); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
if err := buildSitesFunc(); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
g.Go(copyStaticFunc)
|
||||||
|
g.Go(buildSitesFunc)
|
||||||
|
if err := g.Wait(); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, s := range Hugo.Sites {
|
for _, s := range Hugo.Sites {
|
||||||
|
|
Loading…
Reference in a new issue