Slide 1

Slide 1 text

Large Scale CSS Refactoring at trivago

Slide 2

Slide 2 text

since 2012 twitter/medium @pistenprinz

Slide 3

Slide 3 text

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

Slide 4

Slide 4 text

Christoph Reinartz - @pistenprinz Ironman - Tech Context
 The Big Picture

Slide 5

Slide 5 text

Christoph Reinartz - @pistenprinz #1 Establish design and code consistency Introduce a Frontend / Design System into the trivago hotel search

Slide 6

Slide 6 text

Christoph Reinartz - @pistenprinz #2 Improve code quality and maintainability Reduce technical debt

Slide 7

Slide 7 text

Christoph Reinartz - @pistenprinz #3 Provide base for modern & sustainable UI rebuild Build modern applications fast

Slide 8

Slide 8 text

Christoph Reinartz - @pistenprinz The former Case Study
 A Pattern Library and Atomic Design

Slide 9

Slide 9 text

Christoph Reinartz - @pistenprinz The old company pages
 Built without Design Thinking and Atomic Design

Slide 10

Slide 10 text

Christoph Reinartz - @pistenprinz The relaunched site
 Built with Design Thinking and Atomic Design

Slide 11

Slide 11 text

Christoph Reinartz - @pistenprinz The first Redesigns
 Company Pages and Quality Test Intro Page

Slide 12

Slide 12 text

Christoph Reinartz - @pistenprinz Where we come from What happened since 2012

Slide 13

Slide 13 text

Christoph Reinartz - @pistenprinz Specificity graph 2012
 The specificity wall

Slide 14

Slide 14 text

No content

Slide 15

Slide 15 text

No content

Slide 16

Slide 16 text

HTML5

Slide 17

Slide 17 text

Christoph Reinartz - @pistenprinz peaks at the beginning of the stylesheet Graph before Ironman
 Way better, but still…

Slide 18

Slide 18 text

Christoph Reinartz - @pistenprinz Before Ironman The Pain Points

Slide 19

Slide 19 text

Christoph Reinartz - @pistenprinz #1 Sprites were out of control We built Frankenstein with Icons

Slide 20

Slide 20 text

No content

Slide 21

Slide 21 text

Christoph Reinartz - @pistenprinz #2 Too much CSS How many Selectors do you use? ALL!

Slide 22

Slide 22 text

Christoph Reinartz - @pistenprinz #3 Too much CSS How many Selectors do you use? ALL!

Slide 23

Slide 23 text

Christoph Reinartz - @pistenprinz #3 Desktop first approach Oh you poor mobile devices

Slide 24

Slide 24 text

Christoph Reinartz - @pistenprinz #4 Inconsistency and missing Styleguide Or how to create fifty shades of grey or anything else

Slide 25

Slide 25 text

No content

Slide 26

Slide 26 text

No content

Slide 27

Slide 27 text

No content

Slide 28

Slide 28 text

No content

Slide 29

Slide 29 text

Christoph Reinartz - @pistenprinz #5 Overly complex CSS/DOM structure div, div, div, span, span, span

Slide 30

Slide 30 text

Christoph Reinartz - @pistenprinz #6 Too much confusion in code Scary comments

Slide 31

Slide 31 text

No content

Slide 32

Slide 32 text

Christoph Reinartz - @pistenprinz Ironman - the scope The three disciplines and the project name

Slide 33

Slide 33 text

Christoph Reinartz - @pistenprinz New CSS Core Old CSS Core normalize.css reset.css border-box content-box mobile first (min-width) desktop first (max-width) media queries inline in separate files embed SVG icon image sprites ITCSS layering [something] BEM, OOCSS [something] Post processing (MQPacker etc.) nothing improved legacy / fallback handling [something]

Slide 34

Slide 34 text

Christoph Reinartz - @pistenprinz Normalize.css incl. border-box switch Replace reset.css and remove content-box for box-sizing

Slide 35

Slide 35 text

Christoph Reinartz - @pistenprinz Mobile first switch Rewrite all media queries

Slide 36

Slide 36 text

Christoph Reinartz - @pistenprinz Replace image sprites with SVGs and Fallback Icon solution based on Grunticon

Slide 37

Slide 37 text

Christoph Reinartz - @pistenprinz Ironman - the oath What we had to promise

Slide 38

Slide 38 text

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

Slide 39

Slide 39 text

Christoph Reinartz - @pistenprinz Stop at components layer
 Fix the things at the root first

Slide 40

Slide 40 text

Christoph Reinartz - @pistenprinz Ironman - technical details What we did

Slide 41

Slide 41 text

Christoph Reinartz - @pistenprinz _declarations includes mixins mobile includes layout.scss elements.scss modules.scss dealform.scss layout.scss elements.scss modules.scss dealform.scss

Slide 42

Slide 42 text

Christoph Reinartz - @pistenprinz settings tools generic elements objects components trumps

Slide 43

Slide 43 text

Christoph Reinartz - @pistenprinz _declarations includes mixins mobile includes layout.scss elements.scss modules.scss dealform.scss

Slide 44

Slide 44 text

Christoph Reinartz - @pistenprinz #1 Refactor > 50k LOC of Scss Rewrite / adapt the whole Scss Base

Slide 45

Slide 45 text

Christoph Reinartz - @pistenprinz #2 Adapt dozens of templates Markup changes needed for the new architecture

Slide 46

Slide 46 text

Christoph Reinartz - @pistenprinz #3 Remove all the Icons coming from sprites Prettify Frankenstein

Slide 47

Slide 47 text

Christoph Reinartz - @pistenprinz #4 Extensive Device-Testing Re-Test the application on all possible device

Slide 48

Slide 48 text

Christoph Reinartz - @pistenprinz #5 Do it in four weeks Time is limited

Slide 49

Slide 49 text

Christoph Reinartz - @pistenprinz Ironman - the business side Management <3 refactoring. Not.

Slide 50

Slide 50 text

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

Slide 51

Slide 51 text

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?

Slide 52

Slide 52 text

Christoph Reinartz - @pistenprinz #1 Be a salesman- Sell it! Proof it! Show benefits! Argue!

Slide 53

Slide 53 text

Christoph Reinartz - @pistenprinz #2 Don’t only think technically! Think like a business person

Slide 54

Slide 54 text

Christoph Reinartz - @pistenprinz Ironman - the numbers People & processes

Slide 55

Slide 55 text

No content

Slide 56

Slide 56 text

Christoph Reinartz - @pistenprinz The People One project team … and infinite supporters

Slide 57

Slide 57 text

Christoph Reinartz - @pistenprinz 9 Front-End Devs 3 Designers 2 QA Release Engineer Management Back-End Devs Performance Lead UBolt UXBolt Product Owner

Slide 58

Slide 58 text

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

Slide 59

Slide 59 text

Christoph Reinartz - @pistenprinz Ironman - the numbers Code and Outcome

Slide 60

Slide 60 text

Christoph Reinartz - @pistenprinz 889 commits in 3 weeks 16 commits per hour #YOLO

Slide 61

Slide 61 text

Christoph Reinartz - @pistenprinz 11973 LOC added That is new / changed code

Slide 62

Slide 62 text

Christoph Reinartz - @pistenprinz 36668 LOC removed Delete all the things (CSS,HTML,JS)

Slide 63

Slide 63 text

Christoph Reinartz - @pistenprinz LOC from 52991 to 39755 Removed nearly 25% of the Scss Base

Slide 64

Slide 64 text

Christoph Reinartz - @pistenprinz Replaced 451 Icons Infinite Icons replaced with SVG Icons

Slide 65

Slide 65 text

Christoph Reinartz - @pistenprinz 352 changed files Twig, Scss, JS, PHP

Slide 66

Slide 66 text

Christoph Reinartz - @pistenprinz Showcase 1
 Desktop first vs. Mobile first

Slide 67

Slide 67 text

No content

Slide 68

Slide 68 text

No content

Slide 69

Slide 69 text

Christoph Reinartz - @pistenprinz Showcase 2
 Sprite Wars vs. SVG beauty

Slide 70

Slide 70 text

No content

Slide 71

Slide 71 text

No content

Slide 72

Slide 72 text

Christoph Reinartz - @pistenprinz Showcase 3
 HTTP Requests

Slide 73

Slide 73 text

Christoph Reinartz - @pistenprinz Showcase 3
 HTTP requests

Slide 74

Slide 74 text

Christoph Reinartz - @pistenprinz Showcase 3
 HTTP requests

Slide 75

Slide 75 text

Christoph Reinartz - @pistenprinz <3 Sorted the colors Established and introduce a color palette

Slide 76

Slide 76 text

trv-blue-light #3f9fc1 trv-red-light #d67763 trv-green-light #8cba3f trv-green-lighter #b2d17f trv-green-dark #4c7b00 trv-juri-light #697379 trv-juri-lighter #9ba2a6 trv-juri-lightest #ebeced trv-blue-dark #005f81 trv-blue #007fad trv-orange #f48f00 trv-red #c94a30 trv-orange-dark #b76b00 trv-orange-light #f6ab3f trv-blue-lightest #e5f2f6 trv-red-lightest #f9ecea trv-orange-lightest #fdf3e5 trv-red-dark #963724 trv-green #66a400 trv-juri #37454d trv-juri-dark #293339 16 12 18 16 12 12 18 12 18 16 * trv-juri-very-light #cdd0d2 trv-red-very-light #f1d1cb trv-green-very-light #d8e8bf trv-orange-very-light #fce3bf trv-blue-very-light #bfdfea trv-red-lighter #e4a49b trv-orange-lighter #f9c780 trv-blue-lighter #7fbfd6 trv-green-lightest #eff5e5

Slide 77

Slide 77 text

2016 2015

Slide 78

Slide 78 text

Christoph Reinartz - @pistenprinz <3 Solved the icon chaos Replaced the image sprites with a SVG icon set

Slide 79

Slide 79 text

description details infobig hotelconnect smiley heart towel star pictures wifi spa beach breakfast pool pet golf tv family eco parking bed_single bed_double bed_small couple universal home menu share edit checkout checkin general rates faq_circle faq info_circle info arrow_right_circle arrow_left_circle arrow_down_circle arrow_up_circle arrow_right arrow_left arrow_down arrow_up tick exclamation x plus minus image media bag chair team candy journalist news hoteltest plus_circle minus_circle x_circle filter dashboard statistics hotel2 hotel travel2 travel booking hotelchain upload delete tick_circle exclamation_circle contact profile info product history giveback lock calendar search publisher career comment download map smiley_belowaverage smiley_satisfactory smiley_good smiley_verygood smiley_excellent smiley_belowaverage smiley_satisfactory smiley_good smiley_verygood smiley_excellent level sort department poi_citycentre poi_airport poi_sight poi_conference poi_harbor poi_mainstation poi_nature poi_nightlife poi_sports filterreset join thin share2 movie call piechart diagram music multimedia wifi spa beach breakfast pool pet golf tv family eco parking bed_single bed_double bed_small couple universal home menu share edit checkout checkin general rates description details infobig hotelconnect smiley heart towel star pictures icn_profile icn_info icn_product icn_history icn_giveback icn_lock icn_calendar icn_search icn_publisher icn_career icn_comment icn_download icn_map icn_dashboard icn_statistics icn_hotel2 icn_hotel icn_travel2 icn_travel icn_booking icn_hotelchain icn_upload icn_delete icn_tick_circle exclamation_circle contact image media bag chair team candy journalist news hoteltest plus_circle minus_circle x_circle icn_filter arrow_right_circle arrow_left_circle arrow_down_circle arrow_up_circle arrow_right arrow_left arrow_down arrow_up tick exclamation x plus minus faq_circle faq info_circle info smiley_belowaverage smiley_satisfactory smiley_good smiley_verygood smiley_excellent smiley_belowaverage smiley_satisfactory smiley_good smiley_verygood smiley_excellent level sort department poi_citycentre poi_airport poi_sight poi_conference poi_harbor poi_mainstation poi_nature poi_nightlife poi_sports join thin filterreset share2 movie call piechart diagram music multimedia

Slide 80

Slide 80 text

Christoph Reinartz - @pistenprinz peaks at the beginning of the stylesheet Graph before Ironman
 Way better, but still…

Slide 81

Slide 81 text

Christoph Reinartz - @pistenprinz New CSS base Adapted old UI components. Can now be easily rebuilt! SVG Graph after Ironman
 Improved curve…

Slide 82

Slide 82 text

Christoph Reinartz - @pistenprinz The metrics
 A/B Test results

Slide 83

Slide 83 text

Christoph Reinartz - @pistenprinz Let’s celebrate


Slide 84

Slide 84 text

Christoph Reinartz - @pistenprinz Moving faster
 The time after - Time for the components

Slide 85

Slide 85 text

Christoph Reinartz - @pistenprinz Faster Product Iterations
 Old version of the search result component

Slide 86

Slide 86 text

Christoph Reinartz - @pistenprinz The new item element
 New version built with pattern lab upon new base

Slide 87

Slide 87 text

Christoph Reinartz - @pistenprinz Move faster than ever before
 Qualify features with faster iterations

Slide 88

Slide 88 text

Christoph Reinartz - @pistenprinz Thanks
 I’m done Christoph Reinartz Team Lead UI/UX Engineering @pistenprinz