Only re-render the view(s) you're working on
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
Sat, 14 Oct 2017 11:40:43 +0000 (13:40 +0200)
committerGitHub <noreply@github.com>
Sat, 14 Oct 2017 11:40:43 +0000 (13:40 +0200)
commit60bd332c1f68e49e6ac439047e7c660865189380
tree49274b7ce5ff73e0f51d6ac9e20740e6e3765f04
parent6a30874f19610a38e846e120aac03c68e12f9b7b
Only re-render the view(s) you're working on

Hugo already, in its server mode,  support partial rebuilds. To put it simply: If you change `about.md`, only that content page is read and processed, then Hugo does some processing (taxonomies etc.) and the full site is rendered.
This commit covers the rendering part: We now only re-render the pages you work on, i.e. the last n pages you watched in the browser (which obviously also includes the  page in the example above).

To be more specific: When you are running the hugo server in watch (aka. livereload) mode, and change a template or a content file, then we do a partial re-rendering of the following:

* The current content page (if it is a content change)
* The home page
* Up to the last 10 pages you visited on the site.

This should in most cases be enough, but if you navigate to something completely different, you may see stale content. Doing an edit will then refresh that page.

Note that this feature is enabled by default. To turn it off, run `hugo server --disableFastRender`.

Fixes #3962
See  #1643
commands/commandeer.go
commands/hugo.go
commands/server.go
common/types/evictingqueue.go [new file with mode: 0644]
common/types/evictingqueue_test.go [new file with mode: 0644]
hugolib/config.go
hugolib/hugo_sites.go
hugolib/hugo_sites_build.go
hugolib/site.go
hugolib/site_render.go