Here’s how we did it
When we began the making changes to our website’s look, we were faced with the question of how to make this transition seamless for our customers. We explored a few different options and ended up choosing one that involved splitting most of our views into two parts. One part contained all the code from our old theme, and the other contained the code from the new theme. Which code is served depends on the color_scheme attribute on the user viewing the page.
What worked well?
One great benefit of this method was that in order to switch between views, all you need to do was change the color scheme attribute on the user you are testing with from the back end. With this method, we were able to test on production without causing any problems for our existing users. Until we were ready to roll this out, no non-admin user had access to the new theme. Rolling the changes out was as simple as running a command to change all users’ color_scheme attributes to the new theme. We were able to do this in batches for a slow rollout until all users were using the new theme.
What was difficult?
We ran into a few instances where changes to the new theme would affect the old theme if the files weren’t properly split into new and old theme sections. It was important to test each change using the new and old themes to make sure that everything was still functional for the existing users. It was a bit more challenging to do code reviews on changes that other teammates made. When adding the new code to the file with the logic for displaying the right part, it made it look like the entire file changed, so using a tool like GitHub’s file comparison tool was unhelpful.
Is this how I should do it?
This was the method that we chose, but there are other methods out there for rolling out a website redesign. Some will create a separate development site to do all their testing and then simply replace the old site files with the new ones when they’re ready to launch. Another way is to slowly make changes to the site and roll them out to production until all changes have been made. Any way you do this will have its own benefits and challenges. I would suggest figuring out your goals for the roll out and weighing the pros and cons of your different options.