@sekmet/gatsby-source-cloudinary
Version:
Source plugin for pulling assets into Gatsby from Cloudinary. It creates links between entry types and asset so they can be queried in Gatsby using GraphQL and creates ImageSharp nodes from your cloudinary image files that are supported by the Sharp image
53 lines (40 loc) • 1.13 kB
text/typescript
interface Options {
node: any
actions: any
createNodeId: any
}
export default async ({ node, actions, createNodeId, createContentDigest, store, cache }: Options) => {
const {createNode, createNodeField, createParentChildLink} = actions
if (node.internal.type === `CloudinaryMedia`) {
//console.log(node)
}
//console.log('NODE == ', node)
/*
let remoteFile
try {
remoteFile = await Promise.resolve(createRemoteFileNode({
url: node.url,
store,
cache,
createNode,
createNodeId
}).then((result) => {
const cloudinaryFileNode = {
id: createNodeId(`${node.id} >>> CloudiaryMediaFile`),
children: [],
parent: node.id,
internal: {
contentDigest: createContentDigest(result),
type: `CloudiaryMediaFile`,
}
}
createNode(cloudinaryFileNode)
createParentChildLink({ parent: node, child: cloudinaryFileNode })
return result
}))
} catch (e) {
// Ignore
console.log(e)
}
*/
}