关于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.简单的来说就是:
- 包管理软件,用于前端
- 可以用命令行安装js,如同我们用apt-get install软件一样
安装bower
这里依赖于node以及Npm,所以我们需要安装nodejs,具体可以参见nodejs官网,不过如果是同Mac os或者是Ubuntu的话,可以用类似于- brew install npm
- 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 js使用bower管理js)
- bower install <name>=<package>#<version>
- bower install jquery#1.4