Bower
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
- start with
.bowerrc
- create
bower.json
- 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"
}
- create bower.json
- bower install jasmine –save
by this way we can sperate test and source code dependence.
publish a bower package
- bower init
- create github repository and push to github
- git tag
- git push –tags
- bower register
- done
- verify bower info
create a new version
- update version in bower.json
- tag the local repository
- push to github //git push –tags
- done
consume
bower update
to update the package
blog comments powered by Disqus