{"name":"gruntfile-editor","version":"0.1.1","description":"API to modify the content of a Gruntfile.js file","main":"index.js","scripts":{"test":"mocha -R spec"},"repository":{"type":"git","url":"git://github.com/SBoudrias/gruntfile-editor.git"},"keywords":["gruntfile","ast"],"author":{"name":"Simon Boudrias","email":"admin@simonboudrias.com"},"license":"MIT","bugs":{"url":"https://github.com/SBoudrias/gruntfile-editor/issues"},"homepage":"https://github.com/SBoudrias/gruntfile-editor","dependencies":{"ast-query":"~0.2.3","lodash":"~2.4.1"},"_id":"gruntfile-editor@0.1.1","dist":{"shasum":"b8db939fdc9831fcea46519b99eb507d9a51ed41","tarball":"http://registry-npm.ywwl.com/gruntfile-editor/download/gruntfile-editor-0.1.1.tgz","integrity":"sha512-P1dKY69lMWh+VOYFrpLeAeYEM/9+54gRvDTN9WW+fSSnUwb2Cq0U4D/7gUhzwW9bR8qYlg3Iy3MDYNPC8o2IJg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCHzBE1Y067ZcVDiev7kpJMmIYr1NJOKFlWoItpgAXokcCIQC2CMLx5ndXm46yIf5Fs9qLSmdVmL8+rpvAFj9USqbDyg=="}],"size":3819,"noattachment":false,"key":"/gruntfile-editor/-/gruntfile-editor-0.1.1.tgz"},"_from":".","_npmVersion":"1.4.6","_npmUser":{"name":"sboudrias","email":"admin@simonboudrias.com"},"maintainers":[{"name":"sboudrias","email":"admin@simonboudrias.com"}],"directories":{},"readme":"Gruntfile Editor\n================\n\n[![npm](https://badge.fury.io/js/gruntfile-editor.svg)](http://badge.fury.io/js/gruntfile-editor) [![tests](https://travis-ci.org/SBoudrias/gruntfile-editor.svg?branch=master)](https://travis-ci.org/SBoudrias/gruntfile-editor) [![Coverage Status](https://coveralls.io/repos/github/SBoudrias/gruntfile-editor/badge.svg?branch=master)](https://coveralls.io/github/SBoudrias/gruntfile-editor?branch=master) [![dependencies](https://david-dm.org/SBoudrias/gruntfile-editor.svg?theme=shields.io)](https://david-dm.org/SBoudrias/gruntfile-editor)\n\nAn API to modify a `Gruntfile.js` content\n\nInstallation\n---------------\n\n```\nnpm install --save gruntfile-editor\n```\n\nExample\n---------------\n\n```javascript\nvar GruntfileEditor = require('gruntfile-editor');\nvar editor = new GruntfileEditor();\n\neditor.insertConfig('compass', '{ foo: \"bar\" }');\n\nfs.writeFileSync('Gruntfile.js', editor.toString());\n```\n\nAPI\n--------------\n\n### `new GruntfileEditor( content )`\n\nCreate a new editor instance. You can pass the content of the Gruntfile to edit to the constructor. If no content is provided, a default file structure is used.\n\n### `editor.insertConfig( name, config )`\n\nInsert a configuration block inside the `grunt.initConfig()` call.\n\n### `editor.registerTask( name, tasks )`\n\nRegister a task inside a named task group\n\n```javascript\neditor.registerTask('build', 'compass');\n// output: grunt.registerTask('build', ['compass']);\n\neditor.registerTask('build', ['compass', 'uglify']);\n// output: grunt.registerTask('build', ['compass', 'uglify']);\n```\n\nYou can specify an optional description.\n\n```javascript\neditor.registerTask('build', 'A task description', ['compass', 'uglify']);\n// output: grunt.registerTask('build', 'A task description', ['compass', 'uglify']);\n```\n\n### `editor.insertVariable( name, value )`\n\nInsert a variable to the top of the Gruntfile.\n\n```javascript\neditor.insertVariable('root', '\"project/foo\"');\n// output: var root = 'project/foo';\n```\n\n### `editor.prependJavaScript( code )`\n\nInsert a piece of arbritary JavaScript code to the top of the Gruntfile.\n\n```javascript\neditor.prependJavaScript('require(\\'load-grunt-tasks\\')(grunt);');\n// output: require('load-grunt-tasks')(grunt);\n```\n\n### `editor.loadNpmTasks( pluginName )`\n\nLoad a Grunt plugin.\n\n```javascript\neditor.loadNpmTasks('grunt-contrib-uglify');\n// output: grunt.loadNpmTasks(\"grunt-contrib-uglify\");\n\neditor.loadNpmTasks(['grunt-contrib-uglify', 'grunt-contrib-concat']);\n// output:\n// grunt.loadNpmTasks(\"grunt-contrib-concat\");\n// grunt.loadNpmTasks(\"grunt-contrib-uglify\");\n```\n\n\n### `editor.toString()`\n\nReturns the modified Gruntfile as a string.\n\nLicence\n-----------\n\nCopyright (c) 2012 Simon Boudrias (twitter: @vaxilart)  \nLicensed under the MIT license.\n","publish_time":1403507444613,"_cnpm_publish_time":1403507444613,"dist-tags":{"latest":"1.2.1"}}