博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
使用Bower管理依赖以及版本控制
阅读量:6214 次
发布时间:2019-06-21

本文共 2969 字,大约阅读时间需要 9 分钟。

Bower用来管理项目的依赖,版本等问题

  1. Bower官方站点: 
  2. 使用NodeJS命令安装Bower: npm install -g bower(依赖Git)
  3. 使用bower install命令安装所需要的依赖,安装后的文件位于bower_components目录下
    1. 常用的安装方式有:
      • bower install jquery (在bower组件库注册)
      • bower install jquery/jquery (GitHub上的短语名)
      • bower install http://example.com/script.js (通过URL安装)
      • bower install git://github.com/user/package.git(Endpoint方式)
      • bower install my/local/folder(本地文件)
      • 更多方式查看:http://bower.io/docs/api/#install 
    1. 安装时可指定版本号:
      • #~1.2.3
      • #^1.2.3
      • #>=1.2.3 <2.0
    2. 可选的配置项
      • -F--force-latest: Force latest version on conflict
      • -p--production: Do not install project devDependencies
      • -S--save: Save installed packages into the project’s bower.json dependencies
      • -D--save-dev: Save installed packages into the project’s bower.json devDependencies
  1. 组件搜索
    1. 'package-name', OR 'keyword', OR 'keyword owner:jquery'
  2. Bower 配置项
    1. power.json ( power init 命令生成)
      1. Interactively create a bower.json with 
      2. The  defines several options, including:

        • name (required): The name of your package; please see  section for how to name your package.
        • version: A semantic version number (see ).
        • main string or array: The primary acting files necessary to use your package.
        • ignore array: An array of paths not needed in production that you want Bower to ignore when installing your package.
        • keywords array of string: (recommended) helps make your package easier to discover
        • dependencies hash: Packages your package depends upon in production. Note that you can specify  of versions for your dependencies.
        • devDependencies hash: Development dependencies.
        • private boolean: Set to true if you want to keep the package private and do not want to register the package in the future.
    2. .powerrc ()
      1. The config is obtained by merging multiple configurations by this order of importance:
        • CLI arguments via --config
        • Environment variables
        • Local .bowerrc located in the current working directory
        • All .bowerrc files upwards the directory tree
        • .bowerrc file located in user’s home folder (~)
        • .bowerrc file located in the global folder (/)
      2. 常用的配置
        1. directory: The path in which installed components should be saved. If not specified this defaults tobower_components.
        2. proxy:The proxy to use for http requests.

        3. https-proxy: The proxy to use for https requests.
        4. timeout: The timeout to be used when making requests in milliseconds, defaults to 60000 ms.

  3. API():
    1. bower home <package> :  Opens a package homepage into your favorite browser.
    2. bower init: Interactively create a bower.json file
    3. bower list: List local packages and possible updates.
    4. bower prune: Uninstalls local extraneous packages
    5. bower update: Updates installed packages to their newest version according to bower.json.
    6. Programmatic API: Bower provides a powerful, programmatic API. All commands can be accessed through thebower.commands object.
    7. Using local cache: Bower supports installing packages from its local cache – without internet connection – if the packages were installed before. (bower install <package> --offline)

转载于:https://www.cnblogs.com/derek-hu/p/4185316.html

你可能感兴趣的文章
linux系统日志
查看>>
企业防火墙的基础配置
查看>>
自然语言处理hanlp的入门基础
查看>>
Flask python框架web开发:零基础入门
查看>>
如何拿到activity log最新一条comments
查看>>
配置 Eureka Server 集群
查看>>
币氪研报lGxshare(GXS)
查看>>
安装zabbix时PHP ldap Warning
查看>>
关于在linux下清屏的几种技巧
查看>>
FTP
查看>>
glusterfs repo
查看>>
centos6.4 ceph安装部署之ceph object storage
查看>>
配置OSPF发布聚合路由
查看>>
NAT/NAPT
查看>>
好程序员分享做HTML5页面你要懂得这些
查看>>
Eclipse及其插件介绍和下载。
查看>>
自己总结并定义一套简单的字节序转换宏
查看>>
原创《分享(Angular 和 Vue)按需加载的项目实践优化方案》
查看>>
窗口一闪而过
查看>>
迭代器 -> 固定的思路. for循环
查看>>