bower install js使用bower管理js

关于bower

Bower is a package manager for the web. It offers a generic, unopinionated solution to the problem of front-end package management, while exposing the package dependency model via an API that can be consumed by a more opinionated build stack. There are no system wide dependencies, no dependencies are shared between different apps, and the dependency tree is flat.
简单的来说就是:

  1. 包管理软件,用于前端
  2. 可以用命令行安装js,如同我们用apt-get install软件一样

安装bower

这里依赖于node以及Npm,所以我们需要安装nodejs,具体可以参见nodejs官网,不过如果是同Mac os或者是Ubuntu的话,可以用类似于


brew install npm
再安装bower

npm install -g bower

安装js包

创建一个简单的配置文件.bowerrc用于配置Bower安装路径


{
      "directory": "public/"
}
安装

bower install angularjs


$ bower install angularjs
bower cached        git://github.com/angular/angularjs.org.git#58ef7908d9
bower validate      58ef7908d9 against git://github.com/angular/angularjs.org.git#*

如果要安装指定版本就是

bower install <name>=<package>#<version>

例如


bower install jquery#1.4


或许您还需要下面的文章:

关于我

Github: @phodal     微博:@phodal     知乎:@phodal    

微信公众号(Phodal)

围观我的Github Idea墙, 也许,你会遇到心仪的项目

QQ技术交流群: 321689806