Skip to content

Hugo server command shall synchronize pages resources, not always overwrite #7957

Open
@lamyseba

Description

@lamyseba

In my website, I have a lot of "static" resources for my pages: video, pdf files, images.... The resources are stored with the page they belong to, in the same directory, in the content section. This seems a good practice and allow using Hugo image processing.
However, when I launch hugo server, with renderToDisk parameter, all the resources are copied on the destinationDir, overwriting what may already exist at this place, even if it's already "up to date".
This is a big problem as it slows a lot server launching when you have like 1GB of resources files. The server launch time jumps to 45 seconds, when it's like 5 seconds without uselessly copying this files. SSD disk may not like this unnecessary write job every time server is launched. And Hugo loose its "blazing fast" feature.

As a test, I moved all my resources files to the /static directory, and build time dropped drastically when re-lauching the server (after the first launch). Because the hugo server command cares about not copying static files that already exists in destinationDir.

Could you please add the same logic for "static" page resources: do not copy resources files to destinationDir if not needed (if there is already a file with same name and modified date in the destinationDir). This shall also apply to generated resources cached in resources/_gen (tipically, resized images). They should not be copied to destinationDir if destinationDir is up to date with those files.

Did not try, but I think the hugo command has the same problem.

If it is needed to force update, hugo server has a --cleanDestinationDir and a --forceSyncStatic options wich would be just fine, I think.

If you need it for test purpose, you can find my repo here: https://github.com/pau-a-velo/pau-a-velo-websource

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions