The best Grunt plugin ever.
npm install grunt-i18next-json2jsshell
npm install grunt-i18next_json2js --save-dev
`
Once the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:
`js
grunt.loadNpmTasks("grunt-i18next_json2js");
`
The "i18next_json2js" task
$3
In your project's Gruntfile, add a section named i18next_json2js to the data object passed into grunt.initConfig().
`js
grunt.initConfig({
i18next_json2js: {
options: {
// Task-specific options go here.
},
your_target: {
// Target-specific file lists and/or options go here.
},
},
});
`
$3
#### options.cwd
See grunt documentation.
For more general information on specifying targets, files and options see the grunt Configuring Tasks guide.
#### options.include
This optional custom property specifies which files to include. If it is omitted, all json files will be included in the specified src folders. Any grunt globbing pattern can be used (array or string).
#### options.src
This required property specifies the folders (not files!) the plugin should look for translation json files.
#### options.outputFile
The generated i18next.js path
$3
`js
grunt.initConfig({
i18next_json2js: {
test_options: {
cwd: "test/locales",
include: ["/*.json", "!/ignore-this.json"],
expand: true,
src: ["*/"],
outputFile: "test/sample/locales/i18next.js",
},
},
});
``