File tree Expand file tree Collapse file tree 1 file changed +20
-9
lines changed Expand file tree Collapse file tree 1 file changed +20
-9
lines changed Original file line number Diff line number Diff line change @@ -561,25 +561,36 @@ func (c *commandeer) fullBuild(watches ...bool) error {
561561 }()
562562 }
563563
564- g . Go ( func () error {
564+ copyStaticFunc := func () error {
565565 cnt , err := c .copyStatic ()
566566 if err != nil {
567567 return fmt .Errorf ("Error copying static files: %s" , err )
568568 }
569569 langCount = cnt
570570 return nil
571- })
572-
573- g .Go (func () error {
571+ }
572+ buildSitesFunc := func () error {
574573 if err := c .buildSites (); err != nil {
575574 return fmt .Errorf ("Error building site: %s" , err )
576575 }
577-
578576 return nil
579- })
580-
581- if err := g .Wait (); err != nil {
582- return err
577+ }
578+ // Do not copy static files and build sites in parallel if cleanDestinationDir is enabled.
579+ // This flag deletes all static resources in /public folder that are missing in /static,
580+ // and it does so at the end of copyStatic() call.
581+ if c .Cfg .GetBool ("cleanDestinationDir" ) {
582+ if err := copyStaticFunc (); err != nil {
583+ return err
584+ }
585+ if err := buildSitesFunc (); err != nil {
586+ return err
587+ }
588+ } else {
589+ g .Go (copyStaticFunc )
590+ g .Go (buildSitesFunc )
591+ if err := g .Wait (); err != nil {
592+ return err
593+ }
583594 }
584595
585596 for _ , s := range Hugo .Sites {
You can’t perform that action at this time.
0 commit comments