How to set shouldDownloadFiles in gatsby-config?

Hi! I want to download my homepage images on front so I can transform/optimize my images during build. But I can't find a good explanation about how to tell Prismic, which images should be downloaden. I tried something like this:

   shouldDownloadFiles: {
          "homepage.data.body.text_section.image_one": true,
        },

But returned Null on localfile.

The documentation on this is pretty vague. I was able to make it work after some trial and error:

 shouldDownloadFiles: {
          'homepage.data.hero_image': true, //non-repeatable image field 
          'homepage.data.body.featured_service.primary.service_image': true, // image field in a slice
        },

I think if the image you're referencing is contained in a slice, you'll simply need to add the "primary" field as shown in my example.

Thanks! Got it to work :slight_smile:

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.