0.1.2 • Published 9 years ago

grunt-resource-json v0.1.2

Weekly downloads
4
License
-
Repository
github
Last release
9 years ago

grunt-resource-json Built with Grunt

A grunt task for converting java resource bundles to json.

Getting Started

This plugin requires Grunt ~0.4.5

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-resource-json --save-dev

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

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

Resource_json task

Run this task with the grunt resource_json command.

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

Options

key_mapper

Type: Function Default: null

Specified function will be invoked to provide additional key to group properties from a single file. Null value means that no additional key will be provided.

Usage Examples

Simple conversion

In this example, running grunt resource_json will convert the two specified source files (in order) to json, merge them and write the output to dist/built.json.

// Project configuration.
grunt.initConfig({
  resource_json: {
    dist: {
      src: ["test/fixtures/multiple_files_no_key_mapper/1", "test/fixtures/multiple_files_no_key_mapper/2"],
      dest: 'dist/build.json'
    },
  }
});

Key mapper function

In this example, running grunt resource_json will convert the two specified source files (in order) to jsons with addtional key, merge them and write the output to dist/built.json.

// Project configuration.
var path = require('path');

grunt.initConfig({
  resource_json: {
    dist: {
      options: {
          key_mapper: path.basename
      },
      src: ["test/fixtures/multiple_files_no_key_mapper/1", "test/fixtures/multiple_files_no_key_mapper/2"],
      dest: 'dist/build.json'
    }
  },
});

Release History

  • 2014-11-29   v0.1.0   First version.