1. Get help
bower --help
2. Custom installation directory packages
New .bowerrc file in the current project, as follows:
{
"directory" : "js/lib"
}
3.bower initialization
Into the project directory, enter the following command:
bower init
You will be prompted to enter some basic information, follow the prompts to press Enter or the space can be, and then generates a bower.json file, to save the configuration of the project.
4. Install the latest version of the package
For example the installation jquery, enter the following:
bower install jquery --save
"dependencies": {
"jquery": "~2.1.4"
}
# Reads the configuration file bower.json install
$ Bower install
# install shorthand by Github
$ Bower install desandro / Masonry
installed via Github repository #
$ Bower install git: // github.com/user/package.git
# through URL install
$ Bower install HTTP: // example.com/script.js
5. Install the specified version of the package
bower install jquery#xxx
xxx is the version number
6. Review the information package
bower info jquery
7. Pack updates
If we do not want to use the latest version of jquery, but want to use the old version, how to do?
You can directly modify jquery version bower.json, and then execute the following command:
bower update
9. Find the package
bower support fuzzy search, for example, to find the package that contains the string bootstrap
bower search bootstrap
10. The package unloading
bower uninstall jquery
11. The cache management
- Clear the cache
bower cache clean
- Listed cache package
bower cache list
- By caching the installation package
bower install <package> --offline
12. Open the home page
$ bower home
$ bower home <package>
$ bower home <package>#<version>
13. List package has been installed
Use the following command to list the current package has been installed, and the available updates.
bower list
bower list --paths
bower list --paths --json
14. Find the package name by URL
bower lookup <name>
15. Check bower version
bower --version