netlify-cms-json-exporter
TypeScript icon, indicating that this package has built-in type declarations

0.1.2 • Public • Published

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

Package Sidebar

Install

npm i netlify-cms-json-exporter

Weekly Downloads

1

Version

0.1.2

License

MIT

Unpacked Size

19.8 kB

Total Files

23

Last publish

Collaborators

  • marcomontalbano