Skip to content

Commit 3f15b1f

Browse files
committed
Add YAML as a data type in 11ty.
1 parent 864f53c commit 3f15b1f

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

.eleventy.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import yaml from 'js-yaml';
2+
13
// development host for playground proxy
24
const PLAYGROUND_PROXY_HOST = 'http://localhost:8788';
35

@@ -13,6 +15,8 @@ const drafts = [
1315
];
1416

1517
export default async function(eleventyConfig) {
18+
eleventyConfig.addDataExtension('yaml', (contents) => yaml.load(contents));
19+
1620
eleventyConfig.addPassthroughCopy('.htaccess');
1721
eleventyConfig.addPassthroughCopy('LICENSE.md');
1822
eleventyConfig.addPassthroughCopy('_headers');

package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,5 +31,8 @@
3131
"rollup": "^4.40.1",
3232
"wrangler": "^4.6.0",
3333
"yaml": "^2.8.0"
34+
},
35+
"dependencies": {
36+
"js-yaml": "^4.1.0"
3437
}
3538
}

0 commit comments

Comments
 (0)