grunt-jquery-json v0.2.1
grunt-jquery-json
Grunt plugin that generates a jquery.json manifest file from package.json. jquery.json manifest files are used by the jQuery Plugin Registry to identify jQuery plugins.
Requirements
- Grunt ~0.3.17
Installation
In the same directory as your project's grunt.js file, install the package via
npm:
npm install grunt-jquery-jsonThen load the jquery-json task in your grunt.js file:
grunt.loadNpmTasks('grunt-jquery-json');And, optionally, add it to the default task (or any other):
grunt.registerTask('default', '[...] jquery-json');Getting Started
To start, make sure your grunt.js file has a pkg config object that has
loaded package.json:
grunt.initConfig({
pkg: '<json:package.json>',
...
});This is a standard Grunt practice, and grunt-jquery-json uses this pkg
config object to build your jquery.json.
Next, run the following grunt command in the same directory as your grunt.js
file:
grunt jquery-jsonIf everything was successful, there should now be a yourplugin.jquery.json
manifest file in that same directory, where yourplugin is the name of your
jQuery plugin. All of the fields used by the jQuery Plugin Registry have been
pulled in from your package.json.
To add or overwrite any fields specific to your jquery.json, simply add a
jqueryjson object with the desired values to your Grunt config:
grunt.initConfig({
...
jqueryjson: {
dependencies: {
jquery: '>=1.4.3'
},
docs: 'https://github.com/jstayton/jquery-plugin/blob/master/README.md',
demo: 'http://jstayton.github.com/jquery-plugin'
}
});In addition to the jquery-json task, there are also two helpers at your
disposal:
get-jquery-jsonreturns the manifest as an object.write-jquery-jsonwrites the manifest to thejquery.jsonfile.
Both accept the pkg object and jqueryjson config object as parameters:
grunt.helper('get-jquery-json', grunt.config('pkg'), grunt.config('jqueryjson'));Feedback
Please open an issue to request a feature or submit a bug report. Or even if you just want to provide some feedback, I'd love to hear. I'm also available on Twitter as @jstayton.
Contributing
- Fork it.
- Create your feature branch (
git checkout -b my-new-feature). - Commit your changes (
git commit -am 'Added some feature'). - Push to the branch (
git push origin my-new-feature). - Create a new Pull Request.
