mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-28 22:19:59 +02:00
node to page: Refactor the build process
To make it easier to follow and understand. Both building and rebuilding now follow a four step flow: 1. Init 2. Process 3. Assemble 4. Render And now there are only one Build method, used for both builds and rebuilds. Updates #2297
This commit is contained in:
@@ -482,7 +482,7 @@ type whatChanged struct {
|
||||
|
||||
// reBuild partially rebuilds a site given the filesystem events.
|
||||
// It returns whetever the content source was changed.
|
||||
func (s *Site) reBuild(events []fsnotify.Event) (whatChanged, error) {
|
||||
func (s *Site) reProcess(events []fsnotify.Event) (whatChanged, error) {
|
||||
|
||||
jww.DEBUG.Printf("Rebuild for events %q", events)
|
||||
|
||||
@@ -763,7 +763,7 @@ func (s *Site) readDataFromSourceFS() error {
|
||||
return err
|
||||
}
|
||||
|
||||
func (s *Site) preProcess(config BuildCfg) (err error) {
|
||||
func (s *Site) process(config BuildCfg) (err error) {
|
||||
s.timerStep("Go initialization")
|
||||
if err = s.initialize(); err != nil {
|
||||
return
|
||||
@@ -785,16 +785,6 @@ func (s *Site) preProcess(config BuildCfg) (err error) {
|
||||
|
||||
}
|
||||
|
||||
func (s *Site) postProcess() (err error) {
|
||||
|
||||
if err = s.buildSiteMeta(); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
s.timerStep("build taxonomies")
|
||||
return
|
||||
}
|
||||
|
||||
func (s *Site) setupPrevNext() {
|
||||
for i, page := range s.Pages {
|
||||
if i < len(s.Pages)-1 {
|
||||
@@ -1333,6 +1323,7 @@ func readCollator(s *Site, results <-chan HandledResult, errs chan<- error) {
|
||||
}
|
||||
|
||||
func (s *Site) buildSiteMeta() (err error) {
|
||||
defer s.timerStep("build Site meta")
|
||||
|
||||
s.assembleMenus()
|
||||
|
||||
|
Reference in New Issue
Block a user