Skip to content

Live-Reload wont update changed page resources published by build options when not processed by resource methods. #13748

@irkode

Description

@irkode

based on the analysis in https://discourse.gohugo.io/t/live-reload-not-serving-changed-js-file/54873/6?u=irkode

A simple page resource in a bundle is by default copied verbatim to the public directory. (unless disabled by build options)

When running Hugo server the resource is copied verbatim.

Changing the content of that particular file makes the server detect a change, but the file is not updated in public folder. Content type seems to be irrelevant (tested with .json and .css).

Source changed /posts/post-3/page.css
...
INFO  livereload: build changed 0 files: []

when using the file as a real page resource and publishing with .RelPermalink the output changes and the file in public is updated. Also the livereload works, In case of a css change the change is visible imediately.

Source changed /posts/post-3/page.css
...
INFO  livereload: build changed 1 files: ["\\posts\\post-3\\page.css"]
INFO  livereload: no page to navigate to, force refresh
INFO  livereload: refreshing CSS "/posts/post-3/page.css"

using `hugo server -w 500 also updates the file in public (but the page has to be refreshed in the browser manually)

Condition: A page resource (simple file) that is published because of build settings (which is the default). This is not handled by any resource function or publishing action.

Expectation: hugo server (livereload) should update published file in public when the source file in content is changed.

As @bep said:

To determine what to rebuild/rerender, Hugo looks at who “uses this page/resource”, and usage comes from calling methods on a page/resource

So we have another case

a page resource should also be published if the above is false and it has been published by build settings before.

What version of Hugo are you using (hugo version)?

hugo v0.147.6-0a5fd8ebb8e2ca798515e8c564c14e32db3b4127+extended windows/amd64 BuildDate=2025-05-27T11:17:16Z VendorInfo=gohugoio
GOOS="windows"
GOARCH="amd64"
GOVERSION="go1.24.0"
github.com/sass/libsass="3.6.6"
github.com/webmproject/libwebp="v1.3.2"
github.com/sass/dart-sass/protocol="3.1.0"
github.com/sass/dart-sass/compiler="1.83.4"
github.com/sass/dart-sass/implementation="1.83.4"

Does this issue reproduce with the latest release?

yes

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions