叛道 Pandao
Web Designer & Developer
Xiamen, China
关注我
开源中国
花瓣
豆瓣
首页
文章笔记
收集
作品
关于我
TOP
Bower 前端资源包管理
发布时间: 2013-12-03
Bower
前端开发
[TOC] ![](uploads/bower-logo.png) Bower 是 Twitter 推出的一款前端资源包管理工具,它以命令行的形式运行,类似于 Node.js 的包管理命令 NPM。 官网:[http://bower.io/](http://bower.io/) #### 安装 bower npm install -g bower #### 创建 bower.json bower init #### bower.json 示例 ```json { "name": "blue-leaf", "version": "1.2.3", "description": "Physics-like animations for pretty particles", "main": [ "js/motion.js", "sass/motion.scss", ], "dependencies": { "get-size": "~1.2.2", "eventEmitter": "~4.2.11" }, "devDependencies": { "qunit": "~1.16.0" }, "moduleType": [ "amd", "globals", "node" ], "keywords": [ "motion", "physics", "particles" ], "authors": [ "Betty Beta
" ], "license": "MIT", "ignore": [ "**/.*", "node_modules", "bower_components", "test", "tests" ] } ``` > 参考文档:[http://bower.io/docs/creating-packages/#description](http://bower.io/docs/creating-packages/#description) #### 安装 bower 包 bower install
# registered package $ bower install jquery # GitHub shorthand $ bower install desandro/masonry # Git endpoint $ bower install git://github.com/user/package.git # URL $ bower install http://example.com/script.js #### 注册包到 bower // bower register
bower register projectName git://github.com/username/projectName.git #### 注销包 已经注册了 bower.io 的账号,可以这样: $ bower login # enter username and password ? Username: ? Password: # unregister packages after successful login $ bower unregister
没有注册的话可以这样: curl -X DELETE "https://bower.herokuapp.com/packages/PACKAGE?access_token=TOKEN" 通过 Github 生成TOKEN 密钥: - 打开 [https://github.com/settings/applications#personal-access-tokens](https://github.com/settings/applications#personal-access-tokens "https://github.com/settings/applications#personal-access-tokens") - 点击 "Generate new token" 按钮来创建。
TOP