Introducing b2tob3: Easier Migration to Bootstrap 3

Having created several Web sites with Bootstrap 2 and migrated just 2 of them to the new version using command line tools like find, sed and a text editor, I figured that this process could be better automated.

So I started working on b2tob3 a command line Python script, that replaces class names that changed form Bootstrap version 2 to Bootstrap 3 in HTML files.

Quickstart

Before you use b2tob3 make sure to have your project files under version control so you can review and if necessary revert the changes made by b2tob3.

# install b2tob3 from PyPI
pip install b2tob3

# change to your version controlled project directory
cd /my/web/project

# run b2tob3
b2tob3

What is Changed?

b2tob3 searches all files ending in .html, .htm, .css or .js in the current directory and its subdirectories and replaces most of the changed class names listed in the Bootstrap documentation.

Some of the Bootstrap 2 class names like inline or add-on may be replaced in places where they shouldn't, especially when your html files are not templates, but contain the content too.

Review and Edit

b2tob3 takes away part of the tedious work of migrating a Web project, but most likely not all of it. So you need to review and test the changes and fix things manually that are not working in Bootstrap 3.

That being said, I appreciate your help making b2tob3 better and migrating from Bootstrap 2 to 3 easier.


This post was written by Ramiro Gómez (@yaph) and published on . Subscribe to the Geeksta RSS feed to be informed about new posts.

Tags: command line migration python web development

Disclosure: External links on this website may contain affiliate IDs, which means that I earn a commission if you make a purchase using these links. This allows me to offer hopefully valuable content for free while keeping this website sustainable. For more information, please see the disclosure section on the about page.


Share post: Facebook LinkedIn Reddit Twitter

Merchandise