< Back to top
Writing Bootstrap 2.x themes in 2018: an adventure in backwards combatability
Blake Thomas in development
2018-03-03

(warning: rant ahead)

Robotics has this fancy little web app for tracking dimension drawings and the parts that get made for them, and one of the things you can configure in the user settings is what colorscheme it should use. Obviously, once I discovered this, my first thought was to ask the guy who maintains the site to add a Solarized theme, to which the response was "go find a Bootstrap theme you like and make a PR". So, knowing absolutely nothing about Bootstrap or how the site front-end was written, I dutifully Googled "bootstrap solarized theme" and found a whole lot of themes proudly advertising how they were designed for Bootstrap version 3.

A quick check of the website source revealed that the site was built on Bootstrap 2.2.1.

Not to be deterred, I tried to load one of the v3 Solarized themes' bootstrap.min.css into Firefox, and - surprise!- it didn't work. After a few more minutes of Googling, I discovered that there aren't any Solarized themes for Bootstrap 2, so I found a theme generator that was still compatible with the old version and dutifully typed in the numbers, clicked the "Save CSS" button, and... nothing happened. No CSS appeared. I was, however, able to download the variables.less file for the theme (which turned out to be of great advantage later). I then decided to look for a different theme generator, but the only one I found that supported Bootstrap v2.x was down at the time.

At this point, I thought "hey, I have the variables.less file, I'll go download the Bootstrap 2.2.1 source and compile that with the new colorscheme. So I hit Github for the old release, installed lesscss, and entered lessc bootstrap.less > solarized-dark.min.css, which instead of compiling the CSS threw some arcane parse error. I decided to give Bootstrap the benefit of the doubt and assumed that the 2.2.1 release had at least compiled at the time it was released and compared versions of lessc; the current is 2.7, whereas Bootstrap 2.2.1 expected 1.3. Clearly lessc has had some breaking changes since then. I was eventually able to compile bootstrap.less with lessphp, and there ends the story of the parts database Solarized theme.

However, the whole experience has left me with some questions:

  1. Why are the tools for Bootstrap 2 already all broken? Bootstrap 3 isn't even 5 years old, and I'm sure I'm not the only person that has to deal with this kind of legacy code (FWIW, where I come from, "legacy code" starts much more than 5 years ago...)

  2. Why doesn't Bootstrap 2.2.1 compile anymore? I'm of firm belief that breaking changes in programming languages shouldn't be a thing after v1.0, and if you do, make sure to provide good migration tools (or even just maintain an archive - I couldn't find lessc 1.3 anywhere).

The assumption being made here that developers will be able to keep up with the latest language changes for years after they release a product is ridiculous and clearly not true. I don't know how it got to this point but writing utilities and assuming they won't be used anymore in a few years is not sustainable.