Skip to content

Instantly share code, notes, and snippets.

View mgmolisani's full-sized avatar
⌨️
Probably typing...

Mike Molisani mgmolisani

⌨️
Probably typing...
View GitHub Profile
@mgmolisani
mgmolisani / gatsby-node-richTextAST.js
Last active January 25, 2019 01:17
gatsby-node.js for Contentful richTextAST GraphQL node
const { GraphQLJSON } = require('gatsby/graphql');
/*
I don't think we need to pathPrefixCacheStr this.
I would expect path prefixing to happen at the sourceNodes call and we are
parsing it's internal content which would have the prefixed changes.
New changes should change the digest in the sourceNodes call.
*/
const richTextASTCacheKey = node =>
`source-contentful-rich-text-AST-${node.internal.contentDigest}`;