02 June 2014

install bower

npm install bower -g

###Basic

install package

go into the project folder, run bower install lodash, by default, the package will be installed under bower_components\directory

uninstall package bower uninstall lodash

install specific package bower install lodash#2.2.1

check package version bower info lodash

update package bower update

list all installed package bower list

searching for a package bower search lodash

create bower.json bower init

.bowerrc file

customize the package directory

{
	"directory": "js/lib"
}

add packages into bower.json

bower install lodash --save
bower install jasmine --save-dev

remove package from bower.json

bower uninstall lodash --save

bower install lodash -q(quite) bower install lodash -s(slient) bower install lodash -v(verbose default)

Bower Cache

bower cache list
bower cache clean

bower will download from cache first, then download from online

bower install lodash -o  //force to load offline

install from local git repository

install without dev dependence

bower install --production  //this will not install dev dependence

bower install lo_=lodash // rename the directory name of the installed package

check the git url of the package

bower lookup angular

bower prune

bower prune  //uninstall the packages that doesn't exists in the bower.package or is not the dependence of the installed package

step to create bower powered project

  1. start with .bowerrc
  2. create bower.json
  3. bower install jquery lodash bootstrap angular angular-resource angular-route –save

for test folder 1. create test folder and under test folder create 2. create a new .bowerrc for test prject

	{
		"directory":"lib"
	}
  1. create bower.json
  2. bower install jasmine –save

by this way we can sperate test and source code dependence.

publish a bower package

  1. bower init
  2. create github repository and push to github
  3. git tag
  4. git push –tags
  5. bower register
  6. done
  7. verify bower info

create a new version

  1. update version in bower.json
  2. tag the local repository
  3. push to github //git push –tags
  4. done

consume

bower update to update the package



blog comments powered by Disqus