Numerous Problems Multiplied
    Wondering what’s next for npm?Check out our public roadmap! »

    grunt-json-prettify

    0.0.2 • Public • Published

    grunt-json-prettify

    A grunt task to prettify JSON files

    Npm Downloads Npm Version Test Coverage Dev Dependencies

    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)

    Install

    npm i grunt-json-prettify

    DownloadsWeekly Downloads

    72

    Version

    0.0.2

    License

    MIT

    Last publish

    Collaborators

    • avatar