Cocy takes your static-file content and turns it into a consumable API for your JAMstack site. The headless content management library, no matter what framework youβre using.
Docs are provided per package.
Name | Description | Package |
---|---|---|
cocy | main docs | |
transform-md | Transform Markdown to HTML | |
transform-yaml | Parse YAML files | |
render-json | Output static JSON files |
See the Roadmap.
π¦ current working directory
β£ π posts
β β£ π Hello-World.md
β β£ π Second-Post.md
import Cocy from 'cocy';
import md from '@cocy/transform-md';
const cocy = new Cocy().use(md); // setup Cocy with Markdown transformer
await cocy.process(); // search for files
for (const file of cocy.files.values()) {
console.log(file.slug);
}
/*
output:
hello-world
second-post
*/
const { data } = cocy.files.getByPath('posts', 'Hello-World.md');
console.log(data.html);
/*
output:
<p>Hey!</p>
*/