https://github.com/bartekbp/grunt-resource-json
https://github.com/bartekbp/grunt-resource-json
Last synced: about 1 year ago
JSON representation
- Host: GitHub
- URL: https://github.com/bartekbp/grunt-resource-json
- Owner: bartekbp
- License: mit
- Created: 2014-11-28T22:53:31.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2015-03-13T18:56:39.000Z (over 11 years ago)
- Last Synced: 2025-05-18T04:48:37.765Z (about 1 year ago)
- Language: JavaScript
- Size: 203 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# grunt-resource-json [](http://gruntjs.com/)
>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](http://gruntjs.com/) before, be sure to check out the
[Getting Started](http://gruntjs.com/getting-started) guide, as it explains how to create
a [Gruntfile](http://gruntjs.com/sample-gruntfile) as well as install and use Grunt plugins.
Once you're familiar with that process, you may install this plugin with this command:
```shell
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:
```js
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](http://gruntjs.com/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`.
```js
// 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`.
```js
// 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-12-19 v0.1.2 Added support for unicode.
* 2014-12-01 v0.1.1 Fixed removing first character of every translated text.
* 2014-11-29 v0.1.0 First version.