Gatsby-source-prismic plugin - shouldDownloadFiles option of all except listed

Hi,

In gatsby-source-prismic plugin shouldDownloadFiles option, is there way to select all files except listed?

I know you can manually select image queries by something like:
page.data.body.attachments.items.attachment': true,
or all images by
shouldDownloadFiles: true,

But is there way to do something like:

shouldDownloadFiles: [true, 
  {
      exception.item1: false, 
      exception.item2: false
  }
]

If not, would be nice to have something like this

Hi @rmatsumoto!
This is possible. shouldDownloadFiles accepts three types of values:

  1. Boolean
  2. Function (receives the field as its only argument)
  3. Object mapping field paths to a boolean or function (receives the field as its only argument)

Specific fields can be ignored by doing #2 or #3.

With #2, you can check the field's attributes (including its URL and size) to determine if the file should be downloaded. With #3, you can do the same as #2, but only for a specific field.

We give an example here: gatsby-source-prismic Technical Reference - Prismic