0.1.2 • Published 3 years ago

netlify-cms-json-exporter v0.1.2

Weekly downloads
5
License
MIT
Repository
-
Last release
3 years ago

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
0.1.2

3 years ago

0.1.0

3 years ago

0.1.1

3 years ago

0.1.0-beta.2

3 years ago

0.1.0-beta.1

3 years ago