{"name":"gruntfile-editor","version":"1.0.0","description":"API to modify the content of a Gruntfile.js file","author":{"name":"Simon Boudrias","email":"admin@simonboudrias.com"},"license":"MIT","keywords":["gruntfile","ast"],"files":["index.js","default-gruntfile.js"],"scripts":{"test":"mocha -R spec"},"repository":{"type":"git","url":"https://github.com/SBoudrias/gruntfile-editor"},"dependencies":{"ast-query":"^1.0.1","lodash":"^3.2.0"},"devDependencies":{"mocha":"^2.1.0"},"gitHead":"2ef868e9da95adcc5a091fca5e3a20a6ca8ea35a","bugs":{"url":"https://github.com/SBoudrias/gruntfile-editor/issues"},"homepage":"https://github.com/SBoudrias/gruntfile-editor","_id":"gruntfile-editor@1.0.0","_shasum":"347df767c673599419e708fbbb8d03b8da1102c2","_from":".","_npmVersion":"2.4.1","_nodeVersion":"0.10.32","_npmUser":{"name":"sboudrias","email":"admin@simonboudrias.com"},"maintainers":[{"name":"sboudrias","email":"admin@simonboudrias.com"}],"dist":{"shasum":"347df767c673599419e708fbbb8d03b8da1102c2","tarball":"http://registry-npm.ywwl.com/gruntfile-editor/download/gruntfile-editor-1.0.0.tgz","integrity":"sha512-O8q2C+7bINzFRs/qr2rjtI4PnXVoLinBdoVgB6pfxeH3Pprb1lF/M6GJpeB9jGlVRn7Vizc4Gbwf72REOaA28w==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDL8RF+9HA3WNUjSg9hcRRojgH7/v6oE3z/CRwvBbj85QIhAO1Uz5xZV24SzoPfdW8ytJflF5+eCcYGHid0mhNV8V+q"}],"size":2868,"noattachment":false,"key":"/gruntfile-editor/-/gruntfile-editor-1.0.0.tgz"},"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":1424244145682,"_cnpm_publish_time":1424244145682,"dist-tags":{"latest":"1.2.1"}}