What is the best practice about the resources folder?

Hi, I’m wondering should I commit the resources folder to my repo? If so, which folders should I commit?

$ ls -l resources/_gen
total 8
drwxr-xr-x 3 razon razon 4096 Sep 15 16:16 assets
drwxr-xr-x 5 razon razon 4096 Sep 15 15:58 images

For small sites I tend to add it to gitignore.

For sites with a lot of images and/or other assets it can make a significant difference in build time if an updated version of the resources exist. In does cases I add it to the repo.

1 Like

Using the cache Github Action is another option: Add Hugo resources example by rodrigoalcarazdelaosa · Pull Request #1159 · actions/cache · GitHub

1 Like

My current take on how I would (in most cases) have the file cache setup look like:

[caches]
  [caches.getjson]
    dir    = ":cacheDir/:project"
    maxAge = -1
  [caches.getcsv]
    dir    = ":cacheDir/:project"
    maxAge = -1
  [caches.images]
    dir    = ":cacheDir/images"
    maxAge = "1440h"
  [caches.assets]
    dir    = ":cacheDir/:project"
    maxAge = -1
  [caches.getresource]
    dir = ":cacheDir/:project"
    maxage = '1h'

For images, I want a durable directory on my PC and on Netlify, which the above gives me out of the box.

3 Likes

It seems very nice idea, and I don’t have to worry about the repository getting too big for pull and push.