Skip to content

Commit 6829c2f

Browse files
committed
docs: adds README.md
1 parent defc507 commit 6829c2f

File tree

1 file changed

+83
-0
lines changed

1 file changed

+83
-0
lines changed

README.md

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
# gatsby-transformer-yaml-netlify
2+
3+
Parses YAML files. Supports a data layout that is compatible with netlify-cms.
4+
5+
## Install
6+
7+
`npm install --save gatsby-transformer-yaml-netlify`
8+
9+
## How to use
10+
11+
```javascript
12+
// In your gatsby-config.js
13+
plugins: [
14+
`gatsby-transformer-yaml-netlify`,
15+
]
16+
```
17+
18+
## Parsing algorithm
19+
20+
If you have a data layout like so:
21+
22+
```
23+
data/
24+
takers/
25+
a-taker.yml // value: a
26+
b-taker.yml // value: b
27+
leavers/
28+
a-leaver.yml // value: a
29+
b-leaver.yml // value: b
30+
```
31+
32+
Then four nodes will be created:
33+
34+
```javascript
35+
[
36+
{
37+
value: 'a',
38+
type: 'TakersYaml'
39+
},
40+
{
41+
value: 'b',
42+
type: 'TakersYaml'
43+
},
44+
{
45+
value: 'a',
46+
type: 'LeaversYaml'
47+
},
48+
{
49+
value: 'b',
50+
type: 'LeaversYaml'
51+
}
52+
]
53+
```
54+
55+
## How to query
56+
57+
You'd be able to query your takers like:
58+
59+
```graphql
60+
{
61+
allTakersYaml {
62+
edges {
63+
node {
64+
value
65+
}
66+
}
67+
}
68+
}
69+
```
70+
71+
And your leavers like:
72+
73+
```graphql
74+
{
75+
allLeaversYaml {
76+
edges {
77+
node {
78+
value
79+
}
80+
}
81+
}
82+
}
83+
```

0 commit comments

Comments
 (0)