讓我們來學API-“REST”[工作流之bower]
-f, --force
说明:Makes various commands more forceful(使各种命令更有力)
bower install --forcere-installs all installed components. It also
forces installation even when there are non-bower directories with
the same name in the components directory. Adding --force also
bypasses the cache, and writes to the cache anyway.(重新安装所有已安装的组件。即使在组件目录(bower_components \bootstrap(e.g.))中有具有相同的名称非bower目录,它也强制安装。添加--force绕过高速缓存,并且无论如何写入高速缓存(本地缓存)。)bower uninstall <package> --forcecontinues uninstallation even
after a dependency conflict(即使依赖冲突仍继续卸载)bower register <package> --forcebypasses confirmation. Login is
still needed.(绕过确认。但登录是仍然需要。)
举个例子:
//安装:
//先进行安装(本地缓存中安装)
bower install jquery -S
//再进行强制安装(从网络中安装)
bower install jquery -f
//卸载:(同时安装bootstrap)
//卸载jquery
bower uninstall jquery
//强制卸载jquery
bower uninstall jquery -f
bower uninstall jquery (冲突时,友好提示)
bower uninstall jquery -f
-j, --json
说明:Output consumable JSON(以JSON 格式输出)
举个栗子:对比输出格式(部分截图)
bower search jquery
//JSON 格式
bower search jquery -j
-l, --loglevel
说明:What level of logs to report. Possible values: error, conflict, warn, action, info, debug(要报告的级别日志。 可能的值:错误,冲突,警告,操作,信息,调试)
举个栗子:级别由高到低,级别低包含级别高的输出信息
//错误
bower uninstall jquery -l=error
//冲突
bower uninstall jquery -l=conflict
-o, --offline
说明:Do not use network connection(不使用互联网连接)
举个栗子:
1. 安装jquery
bower uninstall jquery -S -f '&' bower install jquery -S
2. 离线安装jquery(无校验)
bower uninstall jquery -S -f '&' bower insatll jquery -S -o
-q, --quiet
说明:Only output important information. It is an alias for --loglevel=warn.(仅输出重要信息,它是--loglevel=wan的别名)
-s, --silent
说明:Do not output anything, besides errors. It is an alias for --loglevel=error. Silent is also useful if you have private components that might leak credentials to your CI environment.(除了错误,不要输出任何东西。 它是--loglevel = error的别名。 如果您的私有组件可能泄露您的CI环境的凭据,则静默也很有用。)
-V, --verbose
说明:Makes output more verbose. It is an alias for --loglevel=debug.(使输出信息更详细,它是--loglevel=debug的别名。)
举个例子:对比输出“Available versions:”
bower info jquery
bower info jquery -V
allow-root
--allow-root
说明:Allows running commands as root. Bower is a user command, there is no need to execute it with superuser permissions. However, if you still want to run commands with sudo, use --allow-root option.(允许以root身份运行命令。 Bower是一个用户命令,没有必要用超级用户权限执行它。 但是,如果仍然要使用sudo运行命令,请使用--allow-root选项。)
You can use build tools to easily consume Bower packages.(您可以使用构建工具轻松使用Bower软件包。)
If you use bower list --paths or bower list --paths --json, you will get a simple name-to-path mapping:(如果你使用bower list --paths 或bower list --paths --json ,你将得到一个简单的名称到路径映射:)
$ bower list --paths
# or
$ bower list --paths --json
Every command supports the --json option that makes Bower output JSON. Command result is outputted to stdout and error/logs to stderr.(每个命令都支持--json选项,使Bower输出JSON。 命令结果输出到stdout(标准输出),错误/日志输出到stderr(标准错误)。)
console.log('...')
Running on a continuous integration server(在连续集成服务器上运行)
console.log('...')
Non-interactive mode(非交互模式)
Bower works by default in interactive mode. There are few ways of disabling it:(默认情况下,Bower在交互模式下工作。 有几种方法禁用它:)
- passing
CI=truein environment(在环境中传递CI=true) - passing
--config.interactive=falseto Bower command(传递--config.interactive=false到Bower命令) - attaching a pipe to Bower (e.g. bower install | cat)(将管道连接到Bower(例如bower install | cat))
- redirecting output to file (e.g. bower install > logs.txt)(将输出重定向到文件(例如bower install> logs.txt))
- running Bower through its Programmatic API(通过其编程 API 运行Bower)
When interactive mode is disabled:(禁用交互模式时:)
bower initdoes not work(bower init不工作)bower registerbypass confirmation(bower register绕过确认)bower loginfails unless--tokenparameter is provided(bower login失败,除非提供--token参数)bower installfails on resolution conflicts, instead of asking for
choice(bower install在解决冲突时失败,而不是请求选择)bower uninstalldoesn’t ask for confirmation if dependency is to be
removed(bower uninstall不要求确认是否要删除依赖关系)
举个栗子:
bower init --config.interactive=false
说明:Bower supports installing packages from its local cache – without an internet connection – if the packages were installed before.(Bower 支持从它的本地缓存中安装依赖包——没有网络连接——如果包之前安装了依赖包)
$ bower install <package> --offline
The content of the cache can be listed with bower cache list:(缓存的内容可以用bower cache list列出:)
$ bower cache list
The cache can be cleaned with bower cache clean:(缓存可以用bower cache clean清理:)
$ bower cache clean
至此,bower 的API 就暂时结束了,难得自己看文档,也算一把成长史吧。接下来会学一下构建工具grunt中文站、grunt英文站 和gulp中文站、gulp英文站,包管理工具npm和yarn,脚手架yeoman中文站、yeoman英文站,自己都试着玩一把。
共同學習,寫下你的評論
評論加載中...
作者其他優質文章
![让我们来学API-“REST”[工作流之bower]_ 图片描述](https://img1.sycdn.imooc.com//580322860001869307130363.png)
![让我们来学API-“REST”[工作流之bower]_ bower](https://img1.sycdn.imooc.com//580324b50001ee4205020085.png)
![让我们来学API-“REST”[工作流之bower]_ 图片描述](https://img1.sycdn.imooc.com//5803253b0001c2df05240046.png)
![让我们来学API-“REST”[工作流之bower]_ bower](https://img1.sycdn.imooc.com//580326c3000158fd04810216.png)
![让我们来学API-“REST”[工作流之bower]_ bower](https://img1.sycdn.imooc.com//580327010001f43705190196.png)
![让我们来学API-“REST”[工作流之bower]_ bower](https://img1.sycdn.imooc.com//580330640001741e05880275.png)
![让我们来学API-“REST”[工作流之bower]_ 图片描述](https://img1.sycdn.imooc.com//580336020001b37d07360177.png)
![让我们来学API-“REST”[工作流之bower]_ 图片描述](https://img1.sycdn.imooc.com//58033625000158b307560141.png)
![让我们来学API-“REST”[工作流之bower]_ bower](https://img1.sycdn.imooc.com//5803380b000125db05150311.png)
![让我们来学API-“REST”[工作流之bower]_ bower](https://img1.sycdn.imooc.com//580340450001243b06040180.png)
![让我们来学API-“REST”[工作流之bower]_ bower](https://img1.sycdn.imooc.com//5803426c0001bc0406220082.png)
![让我们来学API-“REST”[工作流之bower]_ bower](https://img1.sycdn.imooc.com//58034258000102a705400252.png)
![让我们来学API-“REST”[工作流之bower]_ bower](https://img1.sycdn.imooc.com//5803424b0001127d06620391.png)