Socket
Socket
Sign inDemoInstall

grunt-json-replace

Package Overview
Dependencies
0
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    grunt-json-replace

Read, replace and write json files


Version published
Weekly downloads
154
decreased by-40.08%
Maintainers
1
Install size
6.76 kB
Created
Weekly downloads
 

Readme

Source

Build Status

grunt-json-replace

Read, replace and write json files

Getting Started

This plugin requires Grunt ~0.4.0

If you haven't used Grunt before, be sure to check out the Getting Started guide, as it explains how to create a Gruntfile as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command:

npm install grunt-json-replace --save-dev

One the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:

grunt.loadNpmTasks('grunt-json-replace');

The "json-replace" task

Overview

In your project's Gruntfile, add a section named json-replace to the data object passed into grunt.initConfig().

grunt.initConfig({
  "json-replace": {
    "options": {
      "space" : "\t",
      "replace" : {
        "node" : {
          "sub" : "value"
        }
      }
    },
    "your_target": {
      "files" : [{
        "src" : "in.json",
        "dest" : "out.json"
      }]
    },
  },
})

Note that since this is a multi-task you have to have at least one target defined for json-replace (otherwise the task won't run)

Options

options.replace

Type: Object Default value: undefined

An object with replacement tokens. Structure should match that of the input file.

options.space

Type: String Default value: '\t'

A string value that is used to format the output JSON

Contributing

In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using Grunt.

Release History

0.1.2 - Added support for removing nodes from the result 0.1.1 - Updated version with better documentation 0.1.0 - Initial release

Keywords

FAQs

Last updated on 09 May 2013

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc