{"id":18735653,"url":"https://github.com/rdmurphy/grunt-copytext","last_synced_at":"2025-11-16T07:30:16.289Z","repository":{"id":30506425,"uuid":"34060823","full_name":"rdmurphy/grunt-copytext","owner":"rdmurphy","description":"A Grunt plugin to convert a properly formatted XLSX spreadsheet into a JSON file for templates using the copytext library.","archived":false,"fork":false,"pushed_at":"2015-04-16T14:52:36.000Z","size":152,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-28T20:48:26.519Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://github.com/rdmurphy/grunt-copytext","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rdmurphy.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-04-16T14:32:23.000Z","updated_at":"2015-04-16T16:11:41.000Z","dependencies_parsed_at":"2022-08-31T09:00:48.701Z","dependency_job_id":null,"html_url":"https://github.com/rdmurphy/grunt-copytext","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rdmurphy%2Fgrunt-copytext","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rdmurphy%2Fgrunt-copytext/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rdmurphy%2Fgrunt-copytext/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rdmurphy%2Fgrunt-copytext/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rdmurphy","download_url":"https://codeload.github.com/rdmurphy/grunt-copytext/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239611986,"owners_count":19668272,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-07T15:17:39.429Z","updated_at":"2025-11-16T07:30:15.984Z","avatar_url":"https://github.com/rdmurphy.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# grunt-copytext [![Build Status](https://travis-ci.org/rdmurphy/grunt-copytext.svg?branch=master)](https://travis-ci.org/rdmurphy/grunt-copytext)\n\n\u003e A Grunt plugin to convert a properly formatted XLSX spreadsheet into a JSON file for templates using the [`copytext`](https://github.com/rdmurphy/node-copytext) library.\n\n## Getting Started\nThis plugin requires Grunt.\n\nIf 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:\n\n```shell\nnpm install grunt-copytext --save-dev\n```\n\nOnce the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:\n\n```js\ngrunt.loadNpmTasks('grunt-copytext');\n```\n\n## The `copytext` task\n\n### Overview\nIn your project's Gruntfile, add a section named `copytext` to the data object passed into `grunt.initConfig()`.\n\n```js\ngrunt.initConfig({\n  copytext: {\n    base: {\n      options: {\n        // Target-specific options go here.\n      },\n      src: // input file\n      dest: // output file\n    }\n  }\n});\n```\n\n`grunt-copytext` fully supports the [all methods](http://gruntjs.com/configuring-tasks#files) of file globbing `Grunt` provides, as well.\n\n### Options\n\n#### options.basetype\nType: `String`\nDefault value: `'keyvalue'`\n\nThe default processor to use for converting XLSX sheets.\n\n#### options.overrides\nType: `Object`\nDefault value: `[]`\n\nA set of key/value pairs that override the `basetype` for each specified sheet.\n\n```js\n// an example of `overrides` in use\n{\n  basetype: 'objectlist',\n  overrides: {\n    META: 'keyvalue'\n  }\n}\n```\n\n#### options.output\nType: `Function`\nDefault value: `function(input) { return JSON.stringify(input); }`\n\nBy default the output of any XLSX files passed into `grunt-copytext` will be written to the `dest` as JSON. Provide your own function to bypass that. `input` represents the `Object` that `copytext` produces after processing the XLSX file.\n\n### Usage Examples\n\n#### Default Options\nIn this example, it is assumed that all XLSX sheets being passed in are in the `keyvalue` format.\n\n```js\ngrunt.initConfig({\n  copytext: {\n    base: {\n      options: {},\n      src: './test/fixtures/basic_keyvalue.xlsx',\n      dest: './tmp/basic_keyvalue.json'\n    }\n  }\n})\n```\n\n#### Custom Options\nIn this example, custom options are used to tell `grunt-copytext` what to pass on to the `copytext` library.\n\n```js\ngrunt.initConfig({\n  copytext: {\n    base: {\n      options: {\n        basetype: 'objectlist',\n        overrides: {\n          SHIBA: 'keyvalue'\n        }\n      },\n      src: './test/fixtures/mixed_keyvalue_objectlist.xlsx',\n      dest: './tmp/mixed_keyvalue_objectlist.json'\n    }\n  }\n});\n```\n\nIf you wanted to process a whole bunch of XLSX files, that is also possible – as long as they all use the same sheet options. Otherwise you'll need to create separate tasks.\n\n```js\ngrunt.initConfig({\n  copytext: {\n    base: {\n      options: {\n        basetype: 'objectlist'\n      },\n      files: [{\n        expand: true,\n        cwd: './test/fixtures/',\n        src: '*.xlsx',\n        dest: './tmp/',\n        ext: '.json'\n      }]\n    }\n  }\n});\n```\n\n## Contributing\nIn 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](http://gruntjs.com/).\n\n## License\nBy [Ryan Murphy](https://twitter.com/rdmurphy).\n\nAvailable under the MIT license.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frdmurphy%2Fgrunt-copytext","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frdmurphy%2Fgrunt-copytext","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frdmurphy%2Fgrunt-copytext/lists"}