gatsby-transformer-yaml-netlify
v1.0.0-alpha.1
Published
Gatsby transformer plugin for yaml that is netlify compatible
Downloads
1
Readme
gatsby-transformer-yaml-netlify
Parses YAML files. Supports a data layout that is compatible with netlify-cms.
Prerequisites
You must be using a version of node that supports object rest/spread (e.g v8.6.0).
Install
npm install --save gatsby-transformer-yaml-netlify@alpha
How to use
// In your gatsby-config.js
plugins: [
`gatsby-transformer-yaml-netlify`,
]
Parsing algorithm
If you have a data layout like so:
data/
takers/
a-taker.yml // value: a
b-taker.yml // value: b
leavers/
a-leaver.yml // value: a
b-leaver.yml // value: b
Then four nodes will be created:
[
{
value: 'a',
type: 'TakersYaml'
},
{
value: 'b',
type: 'TakersYaml'
},
{
value: 'a',
type: 'LeaversYaml'
},
{
value: 'b',
type: 'LeaversYaml'
}
]
How to query
You'd be able to query your takers like:
{
allTakersYaml {
edges {
node {
value
}
}
}
}
And your leavers like:
{
allLeaversYaml {
edges {
node {
value
}
}
}
}