Bower is a package manager for web front end frameworks, libraries, assets and utilities. Bower can manage components that contain HTML, CSS, JavaScript, fonts and image files. Here is a quick start guide on Linux or Mac. Note that bower requires git, node and npm.
- Install node and npm.
-
Install bower using npm
// Skip sudo on Mac if npm is installed as user $ sudo npm install -g bower
- Search available packages using
bower search <query>
$ bower search jquery Search results: jquery-ui git://github.com/components/jqueryui jquery.cookie git://github.com/carhartl/jquery-cookie.git jquery-placeholder git://github.com/mathiasbynens/jquery-placeholder.git ... ...
-
Init bower project and create bower.json
$ mkdir my_bower_project $ cd my_bower_project $ bower init // You can keep all defaults for the purpose of this tutorial $ ls bower.json $ cat bower.json { "name": "my_bower_project", "authors": [ "testauthor" ], "description": "", "main": "", "moduleType": [], "license": "MIT", "homepage": "", "ignore": [ "**/.*", "node_modules", "bower_components", "test", "tests" ] }
-
Install bower package and save dependencies in bower.json (in my_bower_project directory)
$ bower install jquery --save $ ls bower_components/ jquery $ ls bower_components/jqyery/ AUTHORS.txt LICENSE.txt README.md bower.json dist src
-
Update packages (based on bower.json)
$ bower update
-
Uninstall a package (say jquery)
$ bower uninstall jquery
Uninstall a package (say jquery) and save state in bower.json
$ bower uninstall jquery --save