Converts java .properties files to javascript object. Usage example: configurations, translation files.
This plugin requires Grunt ~0.4.1
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 nortal-grunt-properties --save-dev
Once the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:
grunt.loadNpmTasks('nortal-grunt-properties');
In your project's Gruntfile, add a section named properties
to the data object passed into grunt.initConfig()
.
grunt.initConfig({
properties: {
english: {
files: {
'tmp/test_en.js': ['test/fixtures/module1_en.properties', 'test/fixtures/module2_en.properties']
}
}
german: {
// before and after the generated object
options: {
before: 'define("german_texts", [], function(){ return ',
after: '; });'
},
files: {
'tmp/test_ge.js': ['test/fixtures/module1_ge.properties']
}
}
}
})
Type: String
Default value: 'window.MESSAGES = '
Text before the generated object.
Type: String
Default value: ';'
Text after the generated object.
grunt.initConfig({
properties: {
files: {
'tmp/test_ge.js': ['test/fixtures/module1_ge.properties'],
},
},
})
grunt.initConfig({
properties: {
german: {
options: {
before: 'define("german_texts", [], function(){ return ',
after: '; });'
},
files: {
'tmp/test_ge.js': ['test/fixtures/module1_ge.properties']
}
}
}
})
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.
- 2014-07-08 v0.2.0 Initial release. (NORTAL)
- 2013-05-22 v0.1.0 Initial release. (heldr)
- GitHub heldr/grunt-properties
- node-properties-parser
- The awesome project props2js.