Grunt plugin for convertion xlsx files to json. For multilanguage interfaces, and other
npm install grunt-excel-vocabulary






> The best Grunt plugin ever.
~0.4.5If 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:
``shell`
npm install grunt-excel-vocabulary --save
Once the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:
`js`
grunt.loadNpmTasks('grunt-excel-vocabulary');
to the data object passed into grunt.initConfig().`js
grunt.initConfig({
excel_vocabulary: {
options: {
// Task-specific options go here.
},
your_target: {
// Target-specific file lists and/or options go here.
},
},
});
`$3
#### options.root
Type:
String
Default value: process.cwd()if you need put your translation excel files somewhere in file system, not in process.cwd
#### options.beautify
Type:
String
Default value: trueFor beautify output JSON in file
#### options.keepEveryRowInFile
Type:
boolean
Default value: falseFor writting language entries into separated json files
#### options.set
Type:
FunctionBy default:
`js
set: function (resultJsonObject, columnName, sheetName, key, value) {
if (!resultJsonObject.hasOwnProperty(columnName)) {
resultJsonObject[columnName] = {};
} resultJsonObject[columnName][key] = value;
}
`$3
#### Default Options
In this example, the default options are used to do something with whatever. So if the
testing file has the content Testing and the 123 file had the content 1 2 3, the generated result would be Testing, 1 2 3.`js
grunt.initConfig({
excel_vocabulary: {
first: {
options: {
beautify: false
}
files: [
{ 'translations.json': 'translation.xlsx' },
{ src: 'translation.xlsx', dest: 'translation.json' }
],
},
second: {
files: [{
expand: true,
cwd: 'path/to/source/dir',
dest: 'path/to/build/dir',
src: [
'*/.xlsx'
],
ext: '.json'
}],
}
},
});
`Excel File:
First row is a column names. First column of each row will be a key name.Example:
!file example
(cell colors is not matter)
License
MITSupport
If you have any problems, catch the bug or have any suggestion - please find an existing issue or create newContributing
Do that! How to contribute open-source projectsrun the tests by following command
`shell
$ npm test
``