Bower power
-
Upload
eric-carlisle -
Category
Internet
-
view
1.506 -
download
0
Transcript of Bower power
BOWERPOWERSupercharging
Front-End Manageability
Code:https://github.com/ecarlisle/bower-power
SHAMELESS SELF PROMOTION
Who?
What?
When?
Where?
Eric Carlisle (Consulting, LLC)
UI Developer, UX Designer
20-ish Years
Baltimore, MD
AGENDA
Why do I need this?
Why is it so awesome?
How does it work?
How can I be ultra-awesome with it?
Ever felt like this?
DEPENDENCY MANAGEMENT MESSES
“WTF are we using already?”“What version? Versions?!”“Am I going to break it?”“How can I optimize it?”
DEPENDENCY MANAGEMENT MESSES
KISSAPPROACH
TAKE THE
DEPENDENCY MANAGEMENT MESSES
KeepItStunninglySimple
DEPENDENCY MANAGEMENT MESSES
KeepItStunninglySimple
• Increased Efficiency
• Reduced Cost• Better Process• Better Products• Happy Team• $$$
BOWER KEEPS IT SIMPLE
1. Maintains a dependency manifest.2. Fetches them when you need it.3. Tracks dependencies.4. Integrates with everything.
(NOT A BUILD TOOL LIKE OR )
PREREQUISITES
JavaScript runtime
Node.js package manager
version control system
Suggestion: The Git Bash shell for Windows:
PACKAGE MANAGEMENT SOUP
“WHICH SHOULD I USE?!”
OR
PACKAGE MANAGEMENT SOUP
“I SAY BOTH!!!”
AND
They are similar in many ways, but also have unique strengths.
WHY BOWER TOO?
Bower focuses on client-side dependencies.
1. Abstracts, separates
concerns.
2. Uses a flat dependency
tree.
3. Lives and breathes Git.
4. Establishes accountability.
(For you & components developers
too)
STARTING THE AWESOME
Crack open a command shell:
$ npm install –g bower
Use NPM to install Bower globally.
Initialize Bower configuration from your project root folder.
$ myProject bower init
Prepare for a bunch of questions. If you have NPM configured, many defaults are taken from package.json.
THE BOWER.JSON MANIFAST
{ "name": "bower-power", "version": ”1.0.0”, "description": "Bower Power! Supercharging Front-End Manageability", "main": “", "authors": ["Eric Carlisle [email protected]”], "license": "MIT", "keywords": ["Bower”, “Bower Training”], "homepage": "https://github.com/ecarlisle/bower-power", "moduleType": [], "private": true, "ignore": ["**/.*”, "node_modules”, "bower_components”, "test”, "tests”],}
Included in your applications as well as the dependencies you will install.
(THERE’S ALSO .BOWERRC)
{ "directory": "app/components/", "analytics": false, "timeout": 300000, "registry": { "search": ["https://my-bower-server.local",
“https://bower.herokuapp.com”] }}
Fit Bower to some app & environment requirements.
BOWER API COMMANDS
cache
help
info
lookup
prune
register
unregist
er
link
login
version
Typical Usage:
init
install
list
search
update
uninstall
Component Dev:
Utility:
INSTALLING DEPENDENCIES
# install by name $ bower install jquery
# By (Github) shortcut $ bower install twbs/bootstrap
# By GitHub and Subversion endpoints (SSH, HTTPS, HTTP) $ bower install [email protected]:Modernizr/Modernizr.git
# By URL$ bower install http://http://bower.io/img/bower-logo.png
# By folder$ bower install ~/assets/stylesheets/theme3/variables.sass
… and several, several ways to choose versions.
There are many installation options…
THE BOWER_COMPONENTS FOLDER
Contains EVERYTHING – often more than expected.But that’s ok!
THE BOWER_COMPONENTS FOLDER
• Usually gets the dependency’s entire
GitHub repo.
• Sometimes results in positive discovery
(Hey, look!)
• Empowered to use whatever you need.
• Many ways to integrate needed files into
your project.
• Add bower_components to .gitignore!
TRACK WHAT WE NEED!
# install for production use. $ bower install jquery --save
# Install for testing, debugging, development purposes only. $ bower install modernizr --save-dev
"dependencies": { "jquery": "~2.1.4" },"devDependencies": { "modernizr": ”~3.1.0"},
Production or Dev?
Then in bower.json:
SEMANTIC VERSIONING (SEMVER)
Versioning Pattern: MAJOR.MINOR.PATCH
STRICT1.9.3
SIMPLE>=1.9.3
CLOSE TO~1.9.3
COMPATIBLE WITH^1.9.3
EXAMPLES
INTEGRATE! INTEGRATE! INTEGRATE!
LEVEL UP AWESOMENESS!
INTEGRATE! INTEGRATE! INTEGRATE!
GRUNT
PROGRAMS AND APIS
Bower Programmatic API
bower-installer
GULP INTEGRATION
gulp-bower
gulp-main-bower-files
GRUNT INTEGRATION
grunt-wiredep
BUILD & REGISTER A BOWER PACKAGE
• Have a working GitHub repository.
• Please don’t squat dependency names.
• Make certain your bower.json is solid!
# Indicate package name and Github endpoint.$ bower register my-package https://github.com/you/my-package.git
http://bower.io/search/Bower Registry: