If by this, you mean while running hugo server again, see from docs:
‘hugo server’ will avoid writing the rendered and served content to disk, preferring to store it in memory.
It is not using the files in public. You can see this behaviour clearly by making changes to your site (layout/content/etc) which, if running hugo server, will update localhost:1313 immediately, while the public folder will be untouched.
The key insight here is that if you need to do any postprocessing on the output of Hugo, you can’t rely on hugo server to serve the files anymore, and need to use another solution for serving.
I have been wanting to get the hot reloading functionality + postprocessing and trying to see if that were possible. Thanks for the insight, I will try to rationalize between the two options available.
I’d normally agree with @nternetinspired on this, but it really depends on the script you’re running. For example, my blog uses a script to clean things up after build, and I don’t run or think about that when doing normal development. Hugo Encryptor is different in that it modifies the site in a way that makes it hard to iterate upon (here’s the shortcode it uses, note the display: none).
Re: the tradeoff between hot-reloading and postprocessing, it’s also possible to set up a watcher system using something like Watchman – so you wouldn’t get auto-reloading, but it’s at least possible to have the system rebuild itself automatically on file change, so all you would need to do is switch over to your browser and hit reload. Again, it’s a tradeoff between convenience and complexity