SlideShare a Scribd company logo
BOWER
_by Oleksii Prohonnyi
Bower vs NPM
Bower vs NPM
 NPM and Bower are both dependency management tools. But the
main difference between both is NPM is used for installing Node.js
modules but Bower.js is used for managing front end components
like HTML,CSS,JS etc.
 Bower, unlike NPM, can have multiple files (e.g. .js, .css, .html,
.png, .ttf) which are considered the main file(s). Bower semantically
considers these main files, when packaged together, a component.
Getting started
Install Bower
 Bower is a command line utility. Install it with npm.
$ npm install -g bower
 Bower requires node, npm and git.
 Latest release: v1.7.6
 See more: http://bower.io/
Packages
Configuration
 Packages are defined by a manifest file bower.json. This is similar
to Node’s package.json or Ruby’s Gemfile.
 Interactively create a bower.json with bower init:
$ bower init
 Detailed specification of bower.json file can be found in bower/spec
repository.
Dependencies maintenance
 Bower installs packages to bower_components/ by default.
$ bower install <package>
 Using bower install <package> --save will add <package> to your
project’s bower.json dependencies array.
$ bower install <package> --save
 Similarly, using bower install <package> --save-dev will add
<package> to your project’s bower.json devDependencies array.
$ bower install <package> --save-dev
Dependencies maintenance
 A package can be a GitHub shorthand, a Git endpoint, a URL, and
more.
$ bower install
$ bower install jquery
$ bower install desandro/masonry
$ bower install
git://github.com/user/package.git
$ bower install http://example.com/script.js
Search packages
 If you want to check that the asset you want is a Bower package
you can do a search:
$ bower search <package-name>
 Search bower packages using web interface: http://bower.io/search/
Use packages
 It is recommended to use Bower together with Grunt, RequireJS,
Yeoman, and lots of other tools or build own workflow with the API.
 It is also possible to use the installed packages directly, like this:
<script src=“
bower_components/jquery/dist/jquery.min.js
"></script>
Register packages
 Registering your package allows others to install it with a short
name, like bower install <my-package-name>.
$ bower register <my-package-name> <git-endpoint>
 Now anyone can run bower install <my-package-name>, and get
your library installed. The Bower registry does not have
authentication or user management at this point in time. It’s on a
first come, first served basis.
Unregister packages
 You can unregister packages with bower unregister.
 You first need to authenticate with GitHub with bower login to
confirm you are a contributor to the package repo.
bower login
? Username:
? Password:
bower unregister <package>
 You’ll likely want to bower cache clean after your change.
Commands
Commands list
 cache
 help
 home
 info
 init
 install
 link
 list
 login
 lookup
 prune
 register
 search
 update
 uninstall
 unregister
 version
Programmatic API
 Bower provides a powerful, programmatic API. All commands can
be accessed through the bower.commands object.
 var bower = require('bower');
bower.commands
.install(['jquery'], { save: true }, { /*
custom config */ })
.on('end', function (installed) {
console.log(installed);
});
Configuration
.bowerrc file
 Bower can be configured using JSON in a .bowerrc file. For example:
{
"directory": "app/components/",
"analytics": false,
"timeout": 120000,
"registry": {
"search": [
"http://localhost:8000",
"https://bower.herokuapp.com"
]
}
}
More options
 Full .bowerrc file specification could be found:
http://bower.io/docs/config/#bowerrc-specification
 One can use environment variables in .bowerrc, using the following
syntax ${ENV_VAR}.
"storage": {"packages":“/path/to/${USER}/packages"}
 Bower provides 3 separate hooks that can be used to trigger other
automated tools during Bower usage: preinstall, postinstall,
preuninstall.
Resolvers and tools
Resolvers
 For example, resolvers can be used for:
 Handling Mercurial or Bazaar repositories
 Speeding up checkouts of services like GitLab or Bitbucket
 Allowing to use packages from npm or component.io
 Proxying downloads through 3rd party service like Artifactory
 Implementing custom private registry (hosted on GitHub?)
 Adding authentication support for private GitHub Enterprise
instances
 See more: http://bower.io/docs/pluggable-resolvers/
Resolvers usage
 Pluggable Resolver is just an npm package that you install as
devDependency in the package.json of your repository, or install
globally with npm install -g.
{
"resolvers": [
"bitbucket-resolver",
"github-enterprise-resolver"
]
}
Tools
 Bower is used together with other tools to integrate with all sorts of
setups and workflows.
 Grunt
 Gulp
 Rails & Ruby
 Java
 Apps & IDEs
 Others
 See more: http://bower.io/docs/tools/
THANK YOU FOR ATTENTION
Oleksii Prohonnyi
facebook.com/oprohonnyi
linkedin.com/in/oprohonnyi

More Related Content

ODP
Introduction to Pelican
PPTX
A Brief Introduction to Writing and Understanding Puppet Modules
PPTX
Creating beautiful puppet modules with puppet-lint
ODP
Amazon EC2 + Rails
PPT
eZ Publish cluster unleashed revisited
PDF
JDD 2017: Nginx + Lua = OpenResty (Marcin Stożek)
PDF
Czym jest webpack i dlaczego chcesz go używać?
PPTX
Drupal cambs ansible for drupal april 2015
Introduction to Pelican
A Brief Introduction to Writing and Understanding Puppet Modules
Creating beautiful puppet modules with puppet-lint
Amazon EC2 + Rails
eZ Publish cluster unleashed revisited
JDD 2017: Nginx + Lua = OpenResty (Marcin Stożek)
Czym jest webpack i dlaczego chcesz go używać?
Drupal cambs ansible for drupal april 2015

What's hot (20)

KEY
GuiceCon 2011 - Sisu
PDF
Functional Hostnames and Why they are Bad
PDF
Puppet Intfrastructure as Code
PDF
Docker & CoreOS at Utah Gophers
KEY
Clojure + MongoDB on Heroku
DOC
Php Server Var
PDF
Heroku Tips and Hacks
PDF
Copying files between linux machines using scp and ssh without linux user pas...
PPTX
Puppet barcampexercises.jzt
PDF
Puppet HackDay/BarCamp New Delhi Exercises
PDF
Hadoop installation steps
PDF
Intro KaKao MRTE (MySQL Realtime Traffic Emulator)
PDF
Using docker for data science - part 2
PPTX
От sysV к systemd
PDF
Using python and docker for data science
PDF
Bento lunch talk
PPTX
Installing odoo v8 from github
PPT
Sls01 Lecture02 Linux In Practice
PPTX
Drupal from scratch
PDF
EC CUBE 3.0.x installation guide
GuiceCon 2011 - Sisu
Functional Hostnames and Why they are Bad
Puppet Intfrastructure as Code
Docker & CoreOS at Utah Gophers
Clojure + MongoDB on Heroku
Php Server Var
Heroku Tips and Hacks
Copying files between linux machines using scp and ssh without linux user pas...
Puppet barcampexercises.jzt
Puppet HackDay/BarCamp New Delhi Exercises
Hadoop installation steps
Intro KaKao MRTE (MySQL Realtime Traffic Emulator)
Using docker for data science - part 2
От sysV к systemd
Using python and docker for data science
Bento lunch talk
Installing odoo v8 from github
Sls01 Lecture02 Linux In Practice
Drupal from scratch
EC CUBE 3.0.x installation guide
Ad

Viewers also liked (20)

PPTX
Grunt and Bower
PDF
Dev2Dev - Microformats
PPTX
Introduction to Gulp
PDF
Intro to Gulp
PDF
Bower & bitbucket
PPTX
Cycle.js overview
PPTX
Dive into Angular, part 3: Performance
PPTX
Front-end rich JavaScript application creation (Backbone.js)
PPTX
Conference DotJS 2015 Paris review
PPTX
Dive into Angular, part 5: Experience
PPTX
Как создать сайт за 2 часа? (Wordpress)
PPT
Разработка веб-сайта. Сайт. Зачем он?
PPTX
Exploradores.caroes
PPTX
Chorme devtools
PPTX
Asm.js introduction
PPTX
Moment.js overview
PPTX
Utility libraries to make your life easier
PPTX
D3.JS Tips & Tricks (export to svg, crossfilter, maps etc.)
PPTX
OpenLayer's basics
PPTX
Dive into Angular, part 1: Introduction
Grunt and Bower
Dev2Dev - Microformats
Introduction to Gulp
Intro to Gulp
Bower & bitbucket
Cycle.js overview
Dive into Angular, part 3: Performance
Front-end rich JavaScript application creation (Backbone.js)
Conference DotJS 2015 Paris review
Dive into Angular, part 5: Experience
Как создать сайт за 2 часа? (Wordpress)
Разработка веб-сайта. Сайт. Зачем он?
Exploradores.caroes
Chorme devtools
Asm.js introduction
Moment.js overview
Utility libraries to make your life easier
D3.JS Tips & Tricks (export to svg, crossfilter, maps etc.)
OpenLayer's basics
Dive into Angular, part 1: Introduction
Ad

Similar to Bower introduction (20)

PPTX
Bower - A package manager for the web
PPTX
Introduction to bower
PDF
Angular Part 3 (Basic knowledge)
PPTX
Bower Fundamentals
PPTX
Bower power
PDF
ENIB 2015-2016 - CAI Web - S01E01- La forge JavaScript
PDF
Modern Web Application Development Workflow - EclipseCon US 2014
PDF
Bower & Grunt - A practical workflow
PDF
ENIB 2015 2016 - CAI Web S02E03- Forge JS 1/4 - La forge JavaScript
ODP
Introducing Yeoman 1.0 beta
PDF
Modern Web Application Development Workflow - web2day 2014
PDF
The Secrets of The FullStack Ninja - Part A - Session I
PDF
Workshop 3: JavaScript build tools
PDF
Frontend Build Tools - CC FE & UX
PPTX
Introduction to using Grunt & Bower with WordPress theme development
PDF
GDG Kraków - Intro to front-end automation using bower.js & grunt.js
PDF
Modern Web Application Development Workflow - EclipseCon Europe 2014
PPTX
Don't worry with bower
PPTX
PPTX
Modern Development Tools
Bower - A package manager for the web
Introduction to bower
Angular Part 3 (Basic knowledge)
Bower Fundamentals
Bower power
ENIB 2015-2016 - CAI Web - S01E01- La forge JavaScript
Modern Web Application Development Workflow - EclipseCon US 2014
Bower & Grunt - A practical workflow
ENIB 2015 2016 - CAI Web S02E03- Forge JS 1/4 - La forge JavaScript
Introducing Yeoman 1.0 beta
Modern Web Application Development Workflow - web2day 2014
The Secrets of The FullStack Ninja - Part A - Session I
Workshop 3: JavaScript build tools
Frontend Build Tools - CC FE & UX
Introduction to using Grunt & Bower with WordPress theme development
GDG Kraków - Intro to front-end automation using bower.js & grunt.js
Modern Web Application Development Workflow - EclipseCon Europe 2014
Don't worry with bower
Modern Development Tools

More from Oleksii Prohonnyi (14)

PPTX
Dive into Angular, part 4: Angular 2.0
PPTX
Dive into Angular, part 2: Architecture
PPTX
JavaScript Presentation Frameworks and Libraries
PPTX
Introduction to D3.js
PPTX
Code review process with JetBrains UpSource
PPTX
Google Chrome DevTools features overview
PPTX
BEM methodology overview
PPTX
Front-end development introduction (JavaScript). Part 2
PPTX
Front-end development introduction (HTML, CSS). Part 1
PPTX
Test-driven development & Behavior-driven development basics
PPTX
JavaScript Coding Guidelines
PPTX
Database Optimization (MySQL)
PPTX
PHPCS (PHP Code Sniffer)
PPTX
Usability of UI Design (motivation, heuristics, tools)
Dive into Angular, part 4: Angular 2.0
Dive into Angular, part 2: Architecture
JavaScript Presentation Frameworks and Libraries
Introduction to D3.js
Code review process with JetBrains UpSource
Google Chrome DevTools features overview
BEM methodology overview
Front-end development introduction (JavaScript). Part 2
Front-end development introduction (HTML, CSS). Part 1
Test-driven development & Behavior-driven development basics
JavaScript Coding Guidelines
Database Optimization (MySQL)
PHPCS (PHP Code Sniffer)
Usability of UI Design (motivation, heuristics, tools)

Recently uploaded (20)

PDF
Navsoft: AI-Powered Business Solutions & Custom Software Development
PDF
EN-Survey-Report-SAP-LeanIX-EA-Insights-2025.pdf
PPTX
Introduction to Artificial Intelligence
PPTX
Agentic AI : A Practical Guide. Undersating, Implementing and Scaling Autono...
PDF
iTop VPN Free 5.6.0.5262 Crack latest version 2025
PDF
Claude Code: Everyone is a 10x Developer - A Comprehensive AI-Powered CLI Tool
PPTX
Computer Software and OS of computer science of grade 11.pptx
PPTX
Embracing Complexity in Serverless! GOTO Serverless Bengaluru
PDF
T3DD25 TYPO3 Content Blocks - Deep Dive by André Kraus
PPTX
Transform Your Business with a Software ERP System
PPTX
Agentic AI Use Case- Contract Lifecycle Management (CLM).pptx
PDF
medical staffing services at VALiNTRY
PPTX
Log360_SIEM_Solutions Overview PPT_Feb 2020.pptx
PPTX
Odoo POS Development Services by CandidRoot Solutions
PPTX
history of c programming in notes for students .pptx
PPTX
Reimagine Home Health with the Power of Agentic AI​
PDF
Adobe Illustrator 28.6 Crack My Vision of Vector Design
PPTX
Why Generative AI is the Future of Content, Code & Creativity?
PDF
Design an Analysis of Algorithms I-SECS-1021-03
PDF
Design an Analysis of Algorithms II-SECS-1021-03
Navsoft: AI-Powered Business Solutions & Custom Software Development
EN-Survey-Report-SAP-LeanIX-EA-Insights-2025.pdf
Introduction to Artificial Intelligence
Agentic AI : A Practical Guide. Undersating, Implementing and Scaling Autono...
iTop VPN Free 5.6.0.5262 Crack latest version 2025
Claude Code: Everyone is a 10x Developer - A Comprehensive AI-Powered CLI Tool
Computer Software and OS of computer science of grade 11.pptx
Embracing Complexity in Serverless! GOTO Serverless Bengaluru
T3DD25 TYPO3 Content Blocks - Deep Dive by André Kraus
Transform Your Business with a Software ERP System
Agentic AI Use Case- Contract Lifecycle Management (CLM).pptx
medical staffing services at VALiNTRY
Log360_SIEM_Solutions Overview PPT_Feb 2020.pptx
Odoo POS Development Services by CandidRoot Solutions
history of c programming in notes for students .pptx
Reimagine Home Health with the Power of Agentic AI​
Adobe Illustrator 28.6 Crack My Vision of Vector Design
Why Generative AI is the Future of Content, Code & Creativity?
Design an Analysis of Algorithms I-SECS-1021-03
Design an Analysis of Algorithms II-SECS-1021-03

Bower introduction

  • 3. Bower vs NPM  NPM and Bower are both dependency management tools. But the main difference between both is NPM is used for installing Node.js modules but Bower.js is used for managing front end components like HTML,CSS,JS etc.  Bower, unlike NPM, can have multiple files (e.g. .js, .css, .html, .png, .ttf) which are considered the main file(s). Bower semantically considers these main files, when packaged together, a component.
  • 5. Install Bower  Bower is a command line utility. Install it with npm. $ npm install -g bower  Bower requires node, npm and git.  Latest release: v1.7.6  See more: http://bower.io/
  • 7. Configuration  Packages are defined by a manifest file bower.json. This is similar to Node’s package.json or Ruby’s Gemfile.  Interactively create a bower.json with bower init: $ bower init  Detailed specification of bower.json file can be found in bower/spec repository.
  • 8. Dependencies maintenance  Bower installs packages to bower_components/ by default. $ bower install <package>  Using bower install <package> --save will add <package> to your project’s bower.json dependencies array. $ bower install <package> --save  Similarly, using bower install <package> --save-dev will add <package> to your project’s bower.json devDependencies array. $ bower install <package> --save-dev
  • 9. Dependencies maintenance  A package can be a GitHub shorthand, a Git endpoint, a URL, and more. $ bower install $ bower install jquery $ bower install desandro/masonry $ bower install git://github.com/user/package.git $ bower install http://example.com/script.js
  • 10. Search packages  If you want to check that the asset you want is a Bower package you can do a search: $ bower search <package-name>  Search bower packages using web interface: http://bower.io/search/
  • 11. Use packages  It is recommended to use Bower together with Grunt, RequireJS, Yeoman, and lots of other tools or build own workflow with the API.  It is also possible to use the installed packages directly, like this: <script src=“ bower_components/jquery/dist/jquery.min.js "></script>
  • 12. Register packages  Registering your package allows others to install it with a short name, like bower install <my-package-name>. $ bower register <my-package-name> <git-endpoint>  Now anyone can run bower install <my-package-name>, and get your library installed. The Bower registry does not have authentication or user management at this point in time. It’s on a first come, first served basis.
  • 13. Unregister packages  You can unregister packages with bower unregister.  You first need to authenticate with GitHub with bower login to confirm you are a contributor to the package repo. bower login ? Username: ? Password: bower unregister <package>  You’ll likely want to bower cache clean after your change.
  • 15. Commands list  cache  help  home  info  init  install  link  list  login  lookup  prune  register  search  update  uninstall  unregister  version
  • 16. Programmatic API  Bower provides a powerful, programmatic API. All commands can be accessed through the bower.commands object.  var bower = require('bower'); bower.commands .install(['jquery'], { save: true }, { /* custom config */ }) .on('end', function (installed) { console.log(installed); });
  • 18. .bowerrc file  Bower can be configured using JSON in a .bowerrc file. For example: { "directory": "app/components/", "analytics": false, "timeout": 120000, "registry": { "search": [ "http://localhost:8000", "https://bower.herokuapp.com" ] } }
  • 19. More options  Full .bowerrc file specification could be found: http://bower.io/docs/config/#bowerrc-specification  One can use environment variables in .bowerrc, using the following syntax ${ENV_VAR}. "storage": {"packages":“/path/to/${USER}/packages"}  Bower provides 3 separate hooks that can be used to trigger other automated tools during Bower usage: preinstall, postinstall, preuninstall.
  • 21. Resolvers  For example, resolvers can be used for:  Handling Mercurial or Bazaar repositories  Speeding up checkouts of services like GitLab or Bitbucket  Allowing to use packages from npm or component.io  Proxying downloads through 3rd party service like Artifactory  Implementing custom private registry (hosted on GitHub?)  Adding authentication support for private GitHub Enterprise instances  See more: http://bower.io/docs/pluggable-resolvers/
  • 22. Resolvers usage  Pluggable Resolver is just an npm package that you install as devDependency in the package.json of your repository, or install globally with npm install -g. { "resolvers": [ "bitbucket-resolver", "github-enterprise-resolver" ] }
  • 23. Tools  Bower is used together with other tools to integrate with all sorts of setups and workflows.  Grunt  Gulp  Rails & Ruby  Java  Apps & IDEs  Others  See more: http://bower.io/docs/tools/
  • 24. THANK YOU FOR ATTENTION