{ "name": "grunt-bower-task", "description": "Install Bower packages.", "version": "0.2.3", "homepage": "https://github.com/yatskevich/grunt-bower-task", "author": { "name": "Ivan Yatskevich", "email": "ivan@yatskevich.com" }, "contributors": [ { "name": "Maksim Horbachevsky", "url": "https://github.com/fantactuka" } ], "repository": { "type": "git", "url": "git://github.com/yatskevich/grunt-bower-task.git" }, "bugs": { "url": "https://github.com/yatskevich/grunt-bower-task/issues" }, "licenses": [ { "type": "MIT", "url": "https://github.com/yatskevich/grunt-bower-task/blob/master/LICENSE-MIT" } ], "main": "Gruntfile.js", "engines": { "node": ">= 0.8.0" }, "scripts": { "test": "grunt test" }, "dependencies": { "bower": "~0.9.2", "lodash": "~0.10.0", "rimraf": "~2.0.2", "wrench": "~1.4.3", "colors": "~0.6.0-1", "async": "~0.1.22" }, "devDependencies": { "grunt-contrib-jshint": "0.3.0", "grunt-contrib-nodeunit": "~0.1.2", "grunt": "~0.4.1", "grunt-cli": "~0.1.6" }, "keywords": [ "gruntplugin", "bower" ], "readme": "# grunt-bower-task [![Build Status](https://travis-ci.org/yatskevich/grunt-bower-task.png)](https://travis-ci.org/yatskevich/grunt-bower-task)\n\n> Install Bower packages. Smartly.\n\n## Getting Started\n_If you haven't used [grunt][] before, be sure to check out the [Getting Started][] guide._\n\nPlease note, this plugin works **only with grunt 0.4+**. If you are using grunt 0.3.x then consider an [upgrade to 0.4][].\n\nFrom the same directory as your project's [Gruntfile][Getting Started] and [package.json][], install this plugin with the following command:\n\n```bash\nnpm install grunt-bower-task --save-dev\n```\n\nOnce that's done, add this line to your project's Gruntfile:\n\n```js\ngrunt.loadNpmTasks('grunt-bower-task');\n```\n\nIf the plugin has been installed correctly, running `grunt --help` at the command line should list the newly-installed plugin's task or tasks. In addition, the plugin should be listed in package.json as a `devDependency`, which ensures that it will be installed whenever the `npm install` command is run.\n\n[grunt]: http://gruntjs.com/\n[Getting Started]: https://github.com/gruntjs/grunt/wiki/Getting-started\n[package.json]: https://npmjs.org/doc/json.html\n[upgrade to 0.4]: https://github.com/gruntjs/grunt/wiki/Upgrading-from-0.3-to-0.4\n\n## Grunt task for Bower\n\n### Overview\nIn your project's Gruntfile, add a section named `bower` to the data object passed into `grunt.initConfig()`.\n\n```js\ngrunt.initConfig({\n bower: {\n install: {\n //just run 'grunt bower:install' and you'll see files from your Bower packages in lib directory\n }\n },\n})\n```\n\n### Options\n\n#### options.targetDir\nType: `String`\nDefault value: `./lib`\n\nA directory where you want to keep your Bower packages.\n\n### options.install\nType: `Boolean`\nDefault value: `true`\n\nWhether you want to run bower install task itself (e.g. you might not want to do this each time on CI server).\n\n### options.cleanTargetDir\nType: `Boolean`\nDefault value: `false`\n\nWill clean target dir before running install.\n\n### options.cleanBowerDir\nType: `Boolean`\nDefault value: `false`\n\nWill remove bower's dir after copying all needed files into target dir.\n\n### options.copy\nType: `Boolean`\nDefault value: `true`\n\nCopy Bower packages to target directory.\n\n#### options.cleanup\nType: `boolean`\nDefault value: `undefined`\n\n**NOTE:** If set to true or false then both `cleanBowerDir` & `cleanTargetDir` are set to the value of `cleanup`.\n\n#### options.layout\nType: `string` or `function`\nDefault value: `byType`\n\nThere are two built-in named layouts: `byType` and `byComponent`.\n\n`byType` layout will produce the following structure:\n\n```\nlib\n|-- js\n| |- bootstrap\n| \\- require\n|-- css\n \\- bootstrap\n```\nwhere `js`, `css` come from `exportsOverride` section described below.\n\n`byComponent` will group assets by type under component name:\n\n```\nlib\n|-- bootstrap\n| |- js\n| \\- css\n|-- require\n \\- js\n```\n\nIf you need to support custom layout then you can specify `layout` as a function of `type` and `component`:\n\n```js\nvar path = require('path');\n\ngrunt.initConfig({\n bower: {\n install: {\n options: {\n layout: function(type, component) {\n var renamedType = type;\n if (type == 'js') renamedType = 'javascripts';\n else if (type == 'css') renamedType = 'stylesheets';\n\n return path.join(component, renamedType);\n }\n }\n }\n }\n});\n```\n\n#### options.verbose\nType: `boolean`\nDefault value: `false`\n\nThe task will provide more (debug) output when this option is set to `true`. You can also use `--verbose` when running task for same effect.\n\n### Usage Examples\n\n#### Default Options\nDefault options are good enough if you want to install Bower packages and keep only `\"main\"` files (as specified by package's `component.json`) in separate directory.\n\n```js\ngrunt.initConfig({\n bower: {\n install: {\n options: {\n targetDir: './lib',\n layout: 'byType',\n install: true,\n verbose: false,\n cleanTargetDir: false,\n cleanBowerDir: false\n }\n }\n },\n})\n```\n\n#### Custom Options\nIn this initial version there are no more options in plugin itself. **BUT!**\n\n### Advanced usage\nAt this point of time \"Bower package\" = \"its git repository\". It means that package includes tests, licenses, etc.\nBower's community actively discusses this issue (GitHub issues [#46][],[#88][], [on Google Groups][GG])\nThat's why you can find such tools like [blittle/bower-installer][] which inspired this project.\n\n[GG]: https://groups.google.com/forum/?fromgroups=#!topic/twitter-bower/SQEDDA_gmh0\n[#88]: https://github.com/twitter/bower/issues/88\n[#46]: https://github.com/twitter/bower/issues/46\n[blittle/bower-installer]: https://github.com/blittle/bower-installer\n\nOkay, if you want more than `\"main\"` files in `./lib` directory then put `\"exportsOverride\"` section into your `component.json`:\n\n```json\n{\n \"name\": \"simple-bower\",\n \"version\": \"0.0.0\",\n \"dependencies\": {\n \"jquery\": \"~1.8.3\",\n \"bootstrap-sass\": \"*\",\n \"requirejs\": \"*\"\n },\n \"exportsOverride\": {\n \"bootstrap-sass\": {\n \"js\": \"js/*.js\",\n \"scss\": \"lib/*.scss\",\n \"img\": \"img/*.png\"\n },\n \"requirejs\": {\n \"js\": \"require.js\"\n }\n }\n}\n```\n`grunt-bower-task` will do the rest:\n\n* If Bower package has defined `\"main\"` files then they will be copied to `./lib//`.\n* If `\"main\"` files are empty then the whole package directory will be copied to `./lib`.\n* When you define `\"exportsOverride\"` only asset types and files specified by you will be copied to `./lib`.\n\nFor the example above you'll get the following files in `.lib` directory:\n\n```\njquery/jquery.js\njs/bootstrap-sass/bootstrap-affix.js\n...\njs/bootstrap-sass/bootstrap-typeahead.js\njs/requirejs/require.js\nscss/bootstrap-sass/_accordion.scss\n...\nscss/bootstrap-sass/_wells.scss\nscss/bootstrap-sass/bootstrap.scss\nscss/bootstrap-sass/responsive.scss\nimg/bootstrap-sass/glyphicons-halflings-white.png\nimg/bootstrap-sass/glyphicons-halflings.png\n```\n\n## Contributing\nPlease, use `devel` branch for all pull requests.\n\nIn lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using [grunt][].\n\n## Release History\n* 2013/05/11 - v0.2.3 - Update to bower 0.9.x, docs improvement, Windows-compatible paths in tests.\n* 2013/04/23 - v0.2.2 - Fix backward-compatibility issue (related to `cleanup` option).\n* 2013/04/22 - v0.2.1 - Split 'install' to 'install' and 'copy' steps to support flexible workflow, add support for grunt's `--base` option.\n* 2013/03/30 - v0.2.0 - Added support for flexible assets layout, honor native Bower's configuration, reduce log output.\n* 2013/03/18 - v0.1.1 - Updated dependencies, minor fixes.\n* 2012/11/25 - v0.1.0 - Initial release.\n\n## License\nCopyright (c) 2012-2013 Ivan Yatskevich\n\nLicensed under the MIT license.\n\n\n", "readmeFilename": "README.md", "_id": "grunt-bower-task@0.2.3", "dist": { "shasum": "3ad07d91fa63d0a8e9e09e00d433cdd583b72650" }, "_from": "grunt-bower-task@~0.2.2", "_resolved": "https://registry.npmjs.org/grunt-bower-task/-/grunt-bower-task-0.2.3.tgz" }