Don Chambers wrote:Exactly what role does Grunt and Bower play in your bp?
Bower is a package manager for (not only) JS assets. That means it basically “knows” which JS assets a project includes, pulls them into the project and can (but doesn't have to) keep them up to date.
So in yl-bp, I have a file called bower.json which lists JS plugins
that I frequently use in projects. In that file, I can also specify which version of each JS plugin to get (on 'bower install') and whether to always get the latest version (e.g. on 'bower update'). By doing so, I don't have to keep those files (which update rather frequently) in my boilerplate repository, I can just pull them in using bower.
Grunt is a task runner which I used to create a build script for my projects. It does various (mostly tedious and repetitive) tasks, and it can execute most of them in the background while I develop, usually based on if certain files in the project change. Some of the tasks
are also for testing purposes, e.g. checking HTML, SCSS and JS for structural errors etc. I'm too lazy to explain every nook and cranny of it, but basically it
* compiles SCSS files into CSS (I rarely write vanilla CSS anymore)
* runs autoprefixer which takes care of the vendor prefixes in CSS
* compiles HTML from Handlebars templates (so I can use includes in static HTML)
* combines all JS files into one (which is nice for performance)
* fetches an iconfont build from fontello.com (planning on replacing those with SVG in the future)
On another step, it creates files ready for deployment. This step in addition
* optimizes images using command line tools (again, performance)
* revisions the CSS and JS files referenced in the HTML (again, performance)
* creates an optimized build of Modernizr (yes, performance)
All this either runs in the background while I develop or is executed on a simple command ('grunt deploy'), which puts all the files that need to be deployed in a seperate directory.
It's not ready for s9y projects (yet), but can be easily tweaked to do so, meaning all tasks can also handle .tpl files instead of .html files. However, it can not generate .tpl from Handlebars (because that would be pointless).
Both bower and Grunt run on node.js
, so that's a requirement. Sadly, the tool that checks SCSS files still needs Ruby, so that's another dependency on the build system.