The Great Bootstrap Shootout

There seem to be three major ways to get bootstrap into your rails app.

  1. commit the CSS and JS as downloaded from http://getbootstrap.com
  2. twitter-bootstrap-rails
  3. bootstrap-sass

Things that make me go “hmmm”. Three of them. Hmmm.

To explain: bootstrap is a CSS framework that uses a preprocessor called LESS to make coding such a huge stylesheet bearable and consistent. Named constants FTW! This is what #1 and #2 bring to the table. The first in its statically precompiled glory and the second somewhat more dynamically, but hidden in a gem.

Rails of course has its own CSS preprocessor called SASS hooked up into its asset pipeline. To enable programmers to work with the tools they are familiar with, there is a whole project to (automatically!) convert from less to sass. #3 brings the result of this conversion and hooks it into the aforementioned asset pipeline, to be compiled on deployment. Nice.

Except, that the twitter-bootstrap-rails gem has very nice and helpful helpers, that can be used to build e.g. the navbar, which then go on and automatically recognize which menu_item to activeate based on the current view. Which is bad, since now we have to choose between two evils: lesser functionality or skip on the sassy integration. Ouch. To add insult to injury there is a recent attempt at extracting the helpers which would exactly fill this gap, IFF it weren’t for the fact that this was done in the most shady way by copying the files into a new repository. Also it looks quite abandoned with only two commits.

Anyways, I’ve uploaded both choices as twitter-bootstrap-rails and bootstrap-sass to sleep over it.