Bower

What is Bower

Because there's already a rich ecosystem for this kind of thing. NuGet is great for server side libraries (and some client-side) but there are so many more CSS and JS libs on npm and bower. MSBuild is great for server-side builds but can be overkill when building a client-side app.

Feature

jQuery

Bootstrap

Set up 

1. install Node.js

2. install git 

3. 

$ npm install -g bower

1. install Node.js

2. install git 

Windows users

To use Bower on Windows, you must install msysgit correctly. Be sure to check the option shown below:

command

# 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

Demo

  • 一般下載
    bower install <package>
  • 下載指定版本
    bower install <package>#~x.x.x
  • 修改 bower.json
    bower install

Demo

  • bower list
  • bower info <package>
  • bower lookup <package>
  • bower home <package>
  • bower init
{
  "name": "my-project",
  "version": "1.0.0",
  "main": "path/to/main.css",
  "ignore": [
    ".jshintrc",
    "**/*.txt"
  ],
  "dependencies": {
    "<name>": "<version>",
    "<name>": "<folder>",
    "<name>": "<package>"
  },
  "devDependencies": {
    "<test-framework-name>": "<version>"
  }
}

bower.json

node -v

bower -v

bower install jquery

bower uninstall jquery

bower install jquery#1.9.1

bower bootstrap angular undersore

bower init

del component

bower install

bower install --save

bower uninstall --save

bower --help

bower list --path

Made with Slides.com