一、通过bower help 来展开bower的命令

Usage:

    bower <command> [<args>] [<options>]
Commands: cache Manage bower cache
help Display help information about Bower
home Opens a package homepage into your favorite browser
info Info of a particular package
init Interactively create a bower.json file
install Install a package locally
link Symlink a package folder
list List local packages - and possible updates
login Authenticate with GitHub and store credentials
lookup Look up a single package URL by name
prune Removes local extraneous packages
register Register a package
search Search for packages by name
update Update a local package
uninstall Remove a local package
unregister Remove a package from the registry
version Bump a package version
Options: -f, --force Makes various commands more forceful
-j, --json Output consumable JSON
-l, --loglevel What level of logs to report
-o, --offline Do not hit the network
-q, --quiet Only output important information
-s, --silent Do not output anything, besides errors
-V, --verbose Makes output more verbose
--allow-root Allows running commands as root
-v, --version Output Bower version
--no-color Disable colors
See 'bower help <command>' for more information on a specific command.

  命令不多 ,简单看看,就能理解,基本上和npm类似。

二、包的安装

通常我们简单使用bower install [安装包],但在开发中,项目要上传到版本库时,bower_components文件夹类似node_modules一样,是被忽略(ignore)。

1.初始化,生成配置未见bower.json

bower init

2.安装的软件包,要保存在bower.json的devDependencies中

bower install --save [email protected] #@跟的是版本好,如果不跟,则软件包是最新版本

我就可以查看到bower.json中生成devDependencies

grunt学习三-bower(二)-LMLPHP

几乎和npm没什么区别

三、列出bower下载的软件包的列表

bower list

  

四、查看包的信息

bower info jquery

  

五、搜索包的有哪些版本

bower search bootstrap

  

六、包的卸载

bower uninstall bootstrap

  

05-11 22:32