Caching specific folders to reduce build times

CloudCannon lets you choose certain files and folders to cache between builds. This can let you bypass install steps, speeding up subsequent builds.

Preserved paths

Preserved Paths let you set a comma-separated list of paths that should not be deleted in subsequent builds. These can be folders or full filenames. 

Be careful caching files, as this could result in files sticking around after deleting them from the repo. A good rule is that these paths should also be good examples of paths for your .gitignore file.

If you are doing any image processing or plugin-level caching, specify that directory, or the full filename. A specific example would be caching your node_modules/ directory, which would allow npm install commands to run more quickly on subsequent builds.

To update your preserved paths:

  1. In your Site Settings navigate to BuildsBuild
  2. Locate Preserved Paths under Build options
  3. Enter a comma-separated list of file paths to preserve between builds
  4. Click Update Build Details

Your preserved paths may not be retrieved from cache if your build is allocated to a different server. This only happens if the time between builds is longer than a day.

Was this article helpful? or Suggest an improvement >