Bower 使用
为什么80%的码农都做不了架构师?>>>
Bower使用
1. 安装框架或库到项目
进入项目目录,安装需要用到的框架或者库:
1 2 3 4 5 6 7 8 9 10$ bower
install
bootstrap
$ bower
install
Angular
# 或者指定版本号
$ bower
install
Angular
#1.2.23
# 或者直接指定 git 库下载安装
$ bower
install
git:
//github
.com
/components/jquery
.git
# 或者按照github上的别名
$ bower
install
components
/jquery
# 或者本地库
$ bower
install
.
/repos/jquery
注意:Bower
依赖于版本控制工具git
,需要从github
拉取信息,需要安装git
且设置path。
2. 查看项目中已导入的类库
1$ bower list
bower check-new Checking for new versions of the project dependencies..
atom-test /data/proj/atom-test
├── angular#1.2.23 extraneous (1.2.24-build.441+sha.5061d2c available, latestis 1.3.0-rc.0)
└─┬ bootstrap#3.2.0 extraneous
└── jquery#2.1.1
用bower提交自己类库
1. 生成bower.json配置文件
1$ bower init
[?] name: bower-test
[?] version: 0.0.1
[?] description: bower tools test
[?] main file: bower-test.js
[?] what types of modules does this package expose?
[?] keywords: bower-test
[?] authors: alei
[?] license: MIT
[?] homepage: http://www.u396.com/
[?] set currently installed components as dependencies? No
[?] add commonly ignored files to ignore list? No
[?] would you like to mark this package as private which prevents it from being
[?] would you like to mark this package as private which prevents it from being
accidentally published to the registry? No{
name: ‘bower-test’,
version: ‘0.0.1’,
authors: [
‘alei’
],
description: ‘bower tools test’,
main: ‘bower-test.js’,
keywords: [
‘bower-test’
],
license: ‘MIT’,
homepage: ‘http://www.u396.com/’
}[?] Looks good? Yes
2. 在github创建资源库 bower-test
3. 将本地项目提交至github
1 2 3 4 5$ git init
$ git add .
$ git commit -m "init"
$ git remote add origin https:
//github
.com
/alei817927/bower-test
$ git push -u origin master
4. 注册到bower官方类库
1$ bower register nodejs-bower git@github.com:alei817927
/bower-test
.git
5. 查询自己的包
1$ bower search bower-
test
转载于:https://my.oschina.net/bzhang/blog/483374
标签:
相关文章
-
无相关信息