grunt-data-merge

0.1.1 • Public • Published

grunt-data-merge v0.1.0 Build Status Coverage Status

Merge JSON/YAML data files.

Task takes multiple JSON and/or YAML files and writes merged result of all sources to the destination.

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-data-merge --save-dev

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

grunt.loadNpmTasks('grunt-data-merge');

This plugin was designed to work with Grunt 0.4.x. If you're still using grunt v0.3.x it's strongly recommended that you upgrade, but in case you can't please use v0.3.2.

data-merge task

Run this task with the grunt data-merge command.

Task targets, files and options may be specified according to the grunt Configuring tasks guide.

Options

space

Type: String | Number

Causes the resulting string to be pretty-printed.

Usage Examples

By order, extend common data by partials data, and partials data by pages data:

grunt.loadNpmTasks('grunt-data-merge');
 
grunt.initConfig({
  'data-merge': {
    options: {
      space: 2
    },
 
    build: {
      files: {
        'data/build/index.json': [
          'data/common.json',
          'data/build/partials.yml',
          'data/pages/index.yml'
        ]
      }
    }
});

Release History

  • 2014-12-02   v0.1.0   Initial release

Package Sidebar

Install

npm i grunt-data-merge

Weekly Downloads

0

Version

0.1.1

License

none

Last publish

Collaborators

  • raidendev