netlify-cms-json-exporter
v0.1.2
Published
Export all your Netlify CMS contents in a single object with all relations resolved.
Downloads
12
Maintainers
Readme
Netlify CMS - JSON Exporter
Netlify CMS stores the content in separate folders and files.
With JSON Exporter
you can export all your Netlify CMS contents in a single object with all relations resolved.
This can be useful if need to inject your content as props
inside your components.
Usage
# with yarn
yarn add -D netlify-cms-json-exporter
# with npm
npm install --save-dev netlify-cms-json-exporter
Export as db.json
import fs from 'fs'
import { getContent } from 'netlify-cms-json-exporter'
const content = getContent('./public/admin/config.yml', './content')
fs.writeFileSync('db.json', JSON.stringify(content, undefined, 2))
Typescript .d.ts
// netlify-cms-exporter.js
import { getContent } from 'netlify-cms-json-exporter'
const content = getContent('./public/admin/config.yml', './content')
console.log(
JSON.stringify(content, undefined, 2)
)
node netlify-cms-exporter.js | npx json-ts --stdin --prefix "" > content.d.ts