render-json

1.0.0 • Public • Published

render-json NPM version NPM downloads Build Status XO code style

Render JSON data into your template.

Install

$ npm install --save render-json

Usage

const render = require('render-json')
 
const options = {
  input: 'package.json',
  output: 'README.md'
  template: 'README_template.hbs' // handlebars syntax
}
 
render(options)
  .then(() => {
    console.log('done!')
  })

Template data

{
  json: {}, // parsed input file
  year: 2016 // current year
}

Or the input itself if it's an object.

API

render(options)

options

input

Type: string object
Required: true

  • string Path to input file.
  • object Directly use given object to render template.
output

Type: string
Required: true

Path to output file.

template

Type: string
Required: true

Path to template, handlebars syntax by default.

isPackageJson

Type: boolean
Default: false

Whether the input file should be treated as package.json.

force

Type: boolean
Default: false

Overwrite the output file.

License

MIT © EGOIST

Readme

Keywords

Package Sidebar

Install

npm i render-json

Weekly Downloads

0

Version

1.0.0

License

MIT

Last publish

Collaborators

  • kchan