Blog

Bootstrap Navbar Helpers for Rails and Middleman

I'm in love with the Middleman static website generator and, after discovering it and falling in love with it, I immediately set out to rewrite all static websites I have up and running with Middleman. Since I'm also a heavy user of Bootstrap I ended up writing the HTML (or rather HAML) for the Bootstrap navbar many times as well. What's a Ruby developer to do? Gemify it!

When looking for existing gems that help with creating a Bootstrap navbar, I found Rails-Bootstrap-Navbar. It had implemented most of the methods needed to generate each part of a navbar and had decent documentation as well. Since I wanted to use this for Middleman quickly, I took "inspiration" from the Rails-Bootstrap-Navbar code to build middleman-bootstrap-navbar, but I quickly realized that 90% of the code for both gems end up being identical.

So when Jules Copeland, the creator of Rails-Bootstrap-Navbar, asked if someone else was interested in taking over management of the gem, I jumped in.

Long story short: the meat and potatoes of generating the Bootstrap Navbar was extracted to its own gem (which you, dear reader, can use to implement this functionality in more tools and frameworks) and Rails-Bootstrap-Navbar and middleman-bootstrap-navbar simply contain the glue code that is neccessary to make it work with Rails and Middleman.

Enjoy!

Discuss this post on Hacker News

Ideas? Constructive criticism? Think I'm stupid? Let me know in the comments!