1.0.0 • Published 8 years ago
render-json v1.0.0
render-json
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
1.0.0
8 years ago