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

本文共 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

你可能感兴趣的文章
计算机原理 发展简史
查看>>
分形之二叉树(Binary Tree)
查看>>
程序员的进步从阅读自己的老代码开始
查看>>
How to make a combo box with fulltext search autocomplete support?
查看>>
大数据的三个入口
查看>>
算法生成卐和卍字图
查看>>
java模拟异步消息的发送与回调
查看>>
void指针
查看>>
Oracle用户、权限、角色管理
查看>>
AutoMapper使用手册(一)
查看>>
基本类型赋值转换规则表
查看>>
hackerrank-knapsack
查看>>
SessionFactory的创建和Session的获得
查看>>
Hybrid框架UI重构之路:四、分而治之
查看>>
iOS项目的目录结构(Cocoa China)
查看>>
取消word中所有超链接
查看>>
javascript:addEventListener
查看>>
AABB边框、OBB边框、通过比较球包围
查看>>
Atitit. 软件开发中的管理哲学--一个伟大的事业必然是过程导向为主 过程导向 vs 结果导向...
查看>>
基于opencv的小波变换
查看>>