gatsby properties source plugin
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// i am expecting this to generate an allPropertiesFile thing in graphqil | |
// but it doesn't seem to be reflected in there at all | |
exports.sourceNodes = async ({ actions, createNodeId }) => { | |
const { createNode } = actions | |
// sample data will actually come from files. | |
const data = { | |
'myfolder/file2': { text: 'hi', buttonThing: 'hey' }, | |
'myfolder/file1': { header: 'hi', footer: 'bye' }, | |
} | |
// create 1 node per file??? | |
Object.keys(data).forEach(key => { | |
let node = { | |
id: key, | |
internal: { | |
contentDigest: key, | |
type: 'PropertiesFile', | |
}, | |
node: createNodeId(`properties-file-${key}`), | |
worked: false, | |
test: 123, | |
value: data[key], | |
} | |
createNode(node) | |
console.log('creating node', node) | |
}) | |
// We're done, return. | |
return | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment