Bower introduction

来源:互联网 发布:淘宝做图片视频教程 编辑:程序博客网 时间:2024/05/21 02:21

Overview

Bower is a package manage tool for web, which help you maintain the dependencies in your development.
Bower provides all operations for package management, e.g, search, install, save, update, uninstall. But it does not resolve the dependencies of the package you need. It means bower will install the package you need, but will not install those it depends on. You have to install them additionally.

Usage

First of all, use “npm install -g bower” to install bower. Then you could use “bower init” to initialize your app or package. It will create a bower.json to save the information about your app and package. Bower.json is a manifest file like package.json in node. Detail about bower.json could be found on bower spec on github With bower API, we could install, search, save and use package conveniently. For example, bower install [options] <package>to install dependent package in your app, bower update [package]to update the current installed packages, bower uninstall <package>to remove the package you don’t need. Bower API refer to bower.io.

Configuration

Without configuration, you might appreciate bower’s features. But you could make it more customized for your app with bower’s configuration.
Except CLI, Bower can be configured with .bowerrc file under your project. There are plenty of properties in the configuration which you may find it useful for your project. For example, directorycould define the path where the packages should be saved. proxy will be userful if you are behind a proxy. scriptsprovides hooks like preinstall. ignoreDependencies will ignore some packages when resolving dependencies. Configuration in .bowerrc refer to bower spec on github

0 0
原创粉丝点击