grunt-json-prettify
v0.0.2
Published
A grunt task to prettify JSON files
Downloads
48
Maintainers
Readme
grunt-json-prettify
A grunt task to prettify JSON files
Installation
Install the task:
npm install grunt-json-prettify --save-dev
Then add the task to your Gruntfile.js:
grunt.loadNpmTasks('grunt-json-prettify');
Usage
In your Gruntfile.js:
grunt.initConfig({
jsonprettify: {
options: {
space: 4
},
all: { src: ['lib/*.json'] }
}
});
// For this to work, you need to have run `npm install grunt-simple-mocha`
grunt.loadNpmTasks('grunt-json-prettify');
// Add a default task. This is optional, of course :)
grunt.registerTask('default', 'jsonprettify');
Options
space
Type: Number
Default: 2
The indentation level to be used for pretty printing. (see JSON.stringify)
replacer
Type: Function(key, value)
The replacer function to use when stringifying the JSON object. (see JSON.stringify)
reviver
Type: Function(key, value)
The reviver function to use when parsing the JSON file. (see JSON.parse)