gohugoio / hugo

The world’s fastest framework for building websites.
https://gohugo.io
Apache License 2.0
75.7k stars 7.53k forks source link

Skip update static files in dev mode #5950

Open lamyseba opened 5 years ago

lamyseba commented 5 years ago

Hi. When I launch hugo server, my site take about 2 minutes to do the initial build. I have got a lot of images, and thumbnails of this images, so there are like 1750 static files, a lot of wich do never change. I launch the server with “–render to disk” and “-d” option, but it seems hugo still copies all the static files, even if they already exists in the destination directory. Is there a way to prevent hugo copying already existing static files when launching the server ? The options --noChmod and --noTimes didn’t help to shorten the initial build time.

lamyseba commented 5 years ago

The thumbnails are generated within Hugo itself. But once generated, cached, and copied to the destination dir, all this process could be skipped, especially in dev mode, where the auto-update feature is enough (most part of the website doesn't change). My website source is here: https://github.com/pau-a-velo/pau-a-velo-websource

lamyseba commented 5 years ago

Hi! I suppose this issue is related to #5880, because recently somebody with a mac built my site, and the first time the "first build" took about 20s, and the second time the "first build" (relaunching server) took only 2sec. But on my windows machine (surface 3), it always take more than 2 minutes, be there unused theme or not.

arashrun commented 1 year ago

Hi. When I launch hugo server, my site take about 2 minutes to do the initial build. I have got a lot of images, and thumbnails of this images, so there are like 1750 static files, a lot of wich do never change. I launch the server with “–render to disk” and “-d” option, but it seems hugo still copies all the static files, even if they already exists in the destination directory. Is there a way to prevent hugo copying already existing static files when launching the server ? The options --noChmod and --noTimes didn’t help to shorten the initial build time.

Yes, I meet this question too. There are many large video in my /static. When i call hugo server -D , hugo seems load all the big static files into memory which slow down my PC. I use win11 . Is there any solution or not?

bep commented 1 year ago

Is there any solution or not?

Run with

hugo server --renderStaticToDisk
lamyseba commented 1 year ago

Hi, as for me on a linux platform, --renderStaticToDisk is slower than --renderToDisk. The problem of unnecessary file copying is still valid. As for me, I solved it by generating only recent posts in dev mode, setting ignorefiles on 2017|2018|2019|2020. This is limiting the amount of copied files when starting server.

arashrun commented 1 year ago

emm, That's Command actually not work for me too.