Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clarify usage for multiple resourceTypes #60

Open
evanwinter opened this issue Dec 17, 2022 · 3 comments
Open

Clarify usage for multiple resourceTypes #60

evanwinter opened this issue Dec 17, 2022 · 3 comments

Comments

@evanwinter
Copy link

evanwinter commented Dec 17, 2022

Correct me if I'm wrong, but it seems like the way to source both image and video resourceType's, is to include the gatsby-source-cloudinary plugin twice in gatsby-config.js. Is this the recommended approach?

Example:

module.exports = {
  plugins: [
    ...
    {
      resolve: `gatsby-source-cloudinary`,
      options: {
        cloudName: process.env.CLOUDINARY_CLOUD_NAME,
        apiKey: process.env.CLOUDINARY_API_KEY,
        apiSecret: process.env.CLOUDINARY_API_SECRET,
        resourceType: "image",
      },
    },
    {
      resolve: `gatsby-source-cloudinary`,
      options: {
        cloudName: process.env.CLOUDINARY_CLOUD_NAME,
        apiKey: process.env.CLOUDINARY_API_KEY,
        apiSecret: process.env.CLOUDINARY_API_SECRET,
        resourceType: "video",
      },
    },
    ...
  ]
};

I tried an array ["image", "video"] but resourceType must be a string. Also tried "image,video" but that didn't seem to work.

I feel like it would be nice to call out the recommended way to do this in the docs somewhere (whether that is what I've done or another way). I find it kind of surprising the Gatsby config allows duplicate plugins like this; I tried this as a kind of last-ditch effort and it worked, so some explicit guidance would be super helpful.

@raae
Copy link
Collaborator

raae commented Oct 14, 2023

It's how official plugins from Gatsby do it, but it's not very well known and you'd be welcome to add it to the docs.

@AniqJaved
Copy link

AniqJaved commented Oct 25, 2023

@raae I would like to work on this issue, if it is still open

@raae
Copy link
Collaborator

raae commented Oct 30, 2023

It is; go ahead!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants