{"name":"gruntfile-editor","version":"1.2.1","description":"API to modify the content of a Gruntfile.js file","author":{"name":"Simon Boudrias","email":"admin@simonboudrias.com"},"files":["lib"],"main":"lib/index.js","keywords":["gruntfile","ast"],"license":"MIT","scripts":{"test":"gulp","prepublish":"gulp prepublish"},"repository":{"type":"git","url":"git+https://github.com/sboudrias/gruntfile-editor.git"},"dependencies":{"ast-query":"^2.0.0","lodash":"^4.6.1"},"devDependencies":{"mocha":"^3.1.2","eslint":"^3.10.2","eslint-config-xo-space":"^0.15.0","gulp":"^3.9.0","gulp-eslint":"^3.0.1","gulp-exclude-gitignore":"^1.0.0","gulp-line-ending-corrector":"^1.0.1","gulp-istanbul":"^1.1.1","gulp-mocha":"^3.0.1","gulp-plumber":"^1.0.0","gulp-nsp":"^2.1.0","gulp-coveralls":"^0.1.0"},"eslintConfig":{"extends":"xo-space","env":{"mocha":true},"rules":{"eqeqeq":[2,"allow-null"],"no-eq-null":0,"no-mixed-operators":0,"quotes":0}},"gitHead":"85fcb6994f8fcc3775789e4c51c79cadbfe0d00e","bugs":{"url":"https://github.com/sboudrias/gruntfile-editor/issues"},"homepage":"https://github.com/sboudrias/gruntfile-editor#readme","_id":"gruntfile-editor@1.2.1","_shasum":"366fc1f93cbf045813e1448aef1da9f18289d5eb","_from":".","_npmVersion":"3.10.8","_nodeVersion":"7.0.0","_npmUser":{"name":"sboudrias","email":"admin@simonboudrias.com"},"dist":{"shasum":"366fc1f93cbf045813e1448aef1da9f18289d5eb","tarball":"http://registry-npm.ywwl.com/gruntfile-editor/download/gruntfile-editor-1.2.1.tgz","integrity":"sha512-c0FsVEH7VtoRYx8j8gLnorY4scvaJKuwmFldb4M+ppXyRIhEQf4N0Ff9Z1vzk1H5POHBOFj2X3DqpaGicBJIRA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCA+zqW67vXvHr2U2a7fVgMXylSAQ6DP+Qp7o2aTVfqUwIgD3OLZvNxwJZC8baNTnMl9dHbAHZmrzDReJPn0G/tVXU="}],"size":3473,"noattachment":false,"key":"/gruntfile-editor/-/gruntfile-editor-1.2.1.tgz"},"maintainers":[{"name":"sboudrias","email":"admin@simonboudrias.com"}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/gruntfile-editor-1.2.1.tgz_1479602026781_0.26689936709590256"},"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":1479602027014,"_cnpm_publish_time":1479602027014,"dist-tags":{"latest":"1.2.1"}}