A practical workflow using Bower and Grunt that keeps your vendor folder clean, copies your assets in different locations and makes your dependency management an easy task.
6. Declutter your lib/vendor folder
Too often we end up with 5 different versions of
the same library (jQuery is an always-working
example...).
Which one are we actually using?
7. Dependency management
No more downloads from ten different
websites to get your dependencies.
No more version mismatch problems.
9. vs
● Flexible: install from Bower
registry, GitHub, zip, fs location
● created solely for the front-end
and optimized with that in mind
● flat dependency tree (just one
lib for each type), good for
front-end related stuff
● Most commonly used for
managing Node.js modules
● works for the front-end too when
combined with Browserify
● nested dependency tree (size
heavy), good for server side
modules
16. Is it enough?
Bower is just a tool, helps us organize front
end dependencies and keeps track of versions.
17. What we get
➔ CSS and JS in the same folder
➔ docs/ tests/ src/ minified versions and sourcemaps
are all not needed
➔ Bower components folder can grow if not cleaned
18. What we want
➔ separated vendor folders for CSS and JS
➔ single, non minified version of every lib, nothing else
➔ clean vendor folder containing just used libs and only
one version
20. Why
➔ Consistently positions your dependencies where you
want them in your repository.
➔ Conveniently facilitates tracking your dependencies
without committing the entire Bower components folder.
➔ Has the potential to reduce build times dramatically.
➔ By default, runs bower install for you
28. If you commit your dependencies
1. .gitignore the Bower component folder
2. Add a hook on git pre-commit and run ‘grunt
vendor’ as part of your pre-commit workflow
3. Push your public/css/vendor & public/js/vendor
29. If you DO NOT commit your
dependencies
1. .gitignore the Bower component folder,
public/css/vendor & public/js/vendor
2. Have your CI run ‘npm install’ as first step of the front
end workflow
3. Modify your package.json