Here's the stripped template. I would go check the Gist, as it seem the Syntax Highlighting works funky, plus I added some explanations there.
Here's the Gist, feel free to grab it/fork it/comment. I also created a Github Project to show more less the way I use it. In practice, though, I usually have an extra module that manages all the dependencies.