grunt-camelton v1.1.0
grunt-camelton
Generate and synchronize data skeletons across files.
Getting Started
This plugin requires Grunt ~0.4.5
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 grunt-camelton
Once the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:
grunt.loadNpmTasks('grunt-camelton');
Camelton task
Run this task with the grunt camelton
command.
grunt camelton
Overview
In your project's Gruntfile, add a section named camelton
to the data object
passed into grunt.initConfig()
.
grunt.initConfig({
camelton: {
options: {
// Task-specific options go here.
},
your_target: {
// Target-specific file lists and/or options go here.
},
}
});
Options
options.sort
Type: string
Default: null
Values: "asc"
, "desc"
Sort order for destination objects.
options.prune
Type: boolean
Default: false
Values: true
, false
Prune extra properties found in destination objects.
options.placeholder
Type: boolean
Default: false
Values: true
, false
Add source object key as a value for empty destination object properties.
options.verbose
Type: boolean
Default: false
Values: true
, false
Verbose output.
Usage Examples
In order to understand how camelton
works, please see the usage examples
from the project's README page.
Basic configuration examples
camelton: {
main: {
files: [
// Default options.
{src: 'source.json', dest: 'destination-1.json'},
// Sort option on ("asc").
{sort: 'asc', src: 'source.json', dest: 'destination-1.json'},
// "prune" option on.
{prune: true, src: 'source.json', dest: 'destination-1.json'},
// "placeholder" option on.
{placeholder: true, src: 'source.json', dest: 'destination-1.json'}
]
}
}
Multiple destination files
camelton: {
main: {
src: 'source.json',
dest: ['destination-1.json', 'destination-2.json']
}
}
grunt camelton
Running "camelton:main" (camelton) task
✔ Modified: 2 files.
Default output vs. verbose output
camelton: {
defaultOutput: {
files: {
'destination-1.json': 'source.json'
}
},
verboseOutput: {
options: {
verbose: true
},
files: {
'destination-1.json': 'source.json'
}
}
}
grunt camelton
Running "camelton:defaultOutput" (camelton) task
✔ Modified: 1 file.
Running "camelton:verboseOutput" (camelton) task
✔ Modified: 1 file.
/Users/username/path/to/destination-1.json
Changelog
Please see changelog.
License
Copyright © tuunanen
Licensed under the MIT license.