Introduction to Bower







Things we will go over?



what is Bower and why use it

install

basic use

configuration

advanced

publishing

What is Bower & why use it?


by Twitter open sourced 2012
front-end libraries management tool
runs over Git or other compatible repositories
packages can contain any type of assets
similar to Nuget/RubyGems

makes dependencies management easy
easy integration with development workflow
friendly with Grunt/Gulp/IDEs/many others

Install



npm install -g bower

needs Node
for Windows needs MSysGit
(make sure to have Command Prompt option)

bower install jquery
bower uninstall jquery

Basic use


bower info lodash
bower help install
bower install
bower install jquery#1.11.1 --save
bower update
bower install jquery
bower list
bower search lodash

Configuration


bower.json file
bower init
bower install jquery --save

.bowerrc file

directory - specific directory for packages
merging multiple configurations

Advanced


bower cache list
bower cache clean
bower install lodash -o
bower install https://github.com/lodash/lodash/blob/master/dist/lodash.js
bower install my_dir=lodash
bower lookup angular
bower prune
bower install lodash -j > output.json

Publishing

git init
git add -A
git commit -m "checkin one"
git remote add origin <url>
git push -u origin master
git tag 0.0.1
git push --tags

bower register <name> <url>

Resources


Introduction to Bower

By Kris Ivanov

Introduction to Bower

  • 1,120