Keeping technical debt low while developing a CSS base on a large scale project is a tough challenge. Even more exciting is to refactor existing CSS / frontend foundations which became cluttered.
Running into into consistency issues between code and design which slows down the development of user interface iterations is a common problem in fast growing applications when the development doesn't follow efficient guidelines, styleguides and utilizes an efficient process. At the beginning of 2015 we began establishing a design/frontend system and improving our design-development workflow at trivago. We introduced a pattern library, started utilizing atomic design in our workflow, created new coding guidelines, and adapted several methodologies like BEM and ITCSS in order to support us in maintaining and developing our CSS/UI on a large scale.
The talk will provide backgrounds, insights, learnings and technical approaches of refactoring a CSS base on a large scale project including its scope, the outcome and the business value.
2. Ironman release picture
Crazy Guy
Talking to you
right now
Does something
with frontend at
trivago
Loves giving
presentations
U.Bolt
Performance
Unicorn
3. Christoph Reinartz - @pistenprinz
What is it?
A description
Project Ironman was the technical migration of the
trivago hotel search's existing CSS core to a pattern
library based user interface.*
*) business translation for #refactorAllTheThings
37. Christoph Reinartz - @pistenprinz
Retain the existing Layout &
Design
integrate the new CSS framework base which was
developed with the Pattern Library without changing
the appearance of the site
38. Christoph Reinartz - @pistenprinz
Ironman - technical details
What we had to refactor
39. Christoph Reinartz - @pistenprinz
#1
Refactor > 50k LOC of Scss
Rewrite / adapt the whole Scss Base
40. Christoph Reinartz - @pistenprinz
#2
Adapt dozens of templates
Markup changes needed for the new architecture
41. Christoph Reinartz - @pistenprinz
#3
Keep IE8 support
Yeah we still make money with IE8
42. Christoph Reinartz - @pistenprinz
#4
Remove all the Icons
coming from sprites
Prettify Frankenstein
43. Christoph Reinartz - @pistenprinz
#5
Extensive Device-Testing
Re-Test the application on all possible device
45. Christoph Reinartz - @pistenprinz
Ironman - the business side
Management <3 refactoring. Not. </3
46. Christoph Reinartz - @pistenprinz
How to tell management that you
need 4 weeks of feature freeze
and the User Interface will look
exactly the same afterwards?
Developer goes Marketing
47. Code / Process Audits
How to tell management that you need you need 4 weeks of feature
freeze and the User Interface will exactly look the same afterwards?
48. Christoph Reinartz - @pistenprinz
#1
Be a salesman- Sell it!
Prove it! Show benefits!
Argue!
55. Christoph Reinartz - @pistenprinz
Ironman - Agility
Possible ways to enforce culture
56. Christoph Reinartz - @pistenprinz
#1
People over process
The Agile Manifesto told ya
57. Christoph Reinartz - @pistenprinz
#2
Commitment over
estimation*
Interested to know when you are done, or interested to
be as fast as possible?
*) only works if you meet the deadline
58. Christoph Reinartz - @pistenprinz
#3
Make progress transparent
& involve everybody
Update the stakeholders as often as possible
59. Christoph Reinartz - @pistenprinz
#4
Motivate people and let
them be awesome
Hire awesome people and get out of their way
64. Christoph Reinartz - @pistenprinz
The (lean) Process
3 Meetings +17 Stand-Ups
… and a Kanban board with 67 Post-Its and a slack-
channel is all we needed
68. Christoph Reinartz - @pistenprinz
36668 LOC removed
Delete all the things (CSS,HTML,JS)
69. Christoph Reinartz - @pistenprinz
LOC from 52991 to 39755
Removed nearly 25% of the Scss Base
70. Christoph Reinartz - @pistenprinz
Replaced 451 Icons
Infinite Icons replaced with SVG Icons
71. Christoph Reinartz - @pistenprinz
352 changed files
Infinite Icons replaced with SVG Icons
72. Christoph Reinartz - @pistenprinz
Code / Process Audits
• Foundation built to move the UI Development to the next level
• Better rendering performance on mobile
• Shared knowledge and understanding throughout, between all developers and the entire design/product team
CSS Selectors
Before and after
7009 vs 5605
73. Christoph Reinartz - @pistenprinz
Code / Process Audits
• Foundation built to move the UI Development to the next level
• Better rendering performance on mobile
• Shared knowledge and understanding throughout, between all developers and the entire design/product team
CSS Rules
Before and after
5817 vs 4870
74. Christoph Reinartz - @pistenprinz
Code / Process Audits
• Foundation built to move the UI Development to the next level
• Better rendering performance on mobile
• Shared knowledge and understanding throughout, between all developers and the entire design/product team
CSS Declarations
Before and after
13500 vs 11300