Hugo server freezes after CSS changes

Hi all
I am building a theme in Hugo and am making changes to themes/themename/static/css/style.css while hugo server is running.

After saving, in the terminal I see the message
Static file changes detected 2017-06-20 10:57 -0600 Syncing /css/style.css to /

…but the message never goes away or errors out, and it also doesn’t update the site. Each time I end up just using ctrl + c and restarting the server after/between each css save (not ideal). Is there something I’m missing?

You can use hugo server --watch to have the server watch for file changes and serve them immediately.

I’ve also noticed that sometimes hugo server on its own does not sync. In my case this happens usually when I add binaries in the static folder.

In the past it was recommended to use the --watch flag all the time. But then -don’t remember in which version of Hugo it was- this flag was enabled by default when in web server mode.

I am running Hugo v0.20.7 and so assumed it would be already watching… tried again with explicit hugo server --watch command but getting the same message Static file changes detected 2017-06-20 11:39 -0600 Syncing /css/style.css to /
that stays frozen in my terminal with no update

UPDATE: The CSS is updating but not shown until the page is manually refreshed (Chrome)
How do I get the page to auto-reload??

Livereload is included in Hugo Server and it does exactly that.

When you update a CSS file your browser may display a previously cached version. You either refresh or open an incognito window.

Also why use Hugo 0.20.7? Why not update to the latest version?

Also, any issues with the file watching is always related to the Operating System, so you should tell us. Also, there have been several fixes in this area in recent Hugo versions, so update to the newest version.

@alexandros I just started using Hugo not too long ago and have just never updated. Thanks for the incognito window advice I hadn’t thought of that to get around caching…

I’ll update asap and I’ll let you guys know if there is an actual issue with file watching @bep

I appreciate the help!

FIXED: watch and auto reload work great after upgrade to v.23, even with no incognito mode
Bonus, it forced me to correct the now deprecated .Site.Sections range I had in my home page

1 Like