2.5.0 • Published 3 years ago

@wearepsh/gatsby-plugin-graphql-image v2.5.0

Weekly downloads
-
License
ISC
Repository
github
Last release
3 years ago

gatsby-plugin-graphql-image

Description

Traverses a grapqhl schema sourced from the gatsby-source-graphql plugin and generates file nodes for use with gatsby-plugin-sharp and gatsby-transformer-sharp.

Dependencies

gatsby-source-graphql gatsby-source-filesystem gatsby-plugin-sharp gatsby-transformer-sharp

How to install

npm i -D gatsby-plugin-graphql-image

Available options

images - An array of objects with these options

  • schemaName - The typeName value of your graphql source from the gatsby-source-grapql plugin
  • typeName - The actual graphQL typeName (you can query __typename in GraphiQL to get the actual typeName)
  • fieldName - The name of the field that contains your image URLs
  • baseUrl - (optional) A base url to use in case the values are not absolute paths

Examples of usage

{
  resolve: "gatsby-source-graphql",
  options: {
    typeName: "ROCKETMAKERS",
    fieldName: "rocketmakers",
    url: "https://rocketmakers.com/graphql"
  }
},
{
  resolve: 'gatsby-plugin-graphql-image',
  options: {
    images: [
      {
        schemaName: 'ROCKETMAKERS',
        typeName: 'ROCKETMAKERS_UploadFile',
        fieldName: 'url',
        baseUrl: 'https://rocketmakers.com',
      },
    ]
  }
}